summaryrefslogtreecommitdiff
path: root/glfw/src/lib.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2025-10-18 17:14:46 +0200
committerHampusM <hampus@hampusmat.com>2025-10-18 17:14:46 +0200
commit178723c9627a3aebb2f83dc476abe7d23de63eac (patch)
tree7591c4a864f93d7404af85f3e6a82dd9b972d886 /glfw/src/lib.rs
parent7083a19bf1029bff21a9550d40cc3260e99aac53 (diff)
chore: remove glfw crate
Diffstat (limited to 'glfw/src/lib.rs')
-rw-r--r--glfw/src/lib.rs53
1 files changed, 0 insertions, 53 deletions
diff --git a/glfw/src/lib.rs b/glfw/src/lib.rs
deleted file mode 100644
index f858766..0000000
--- a/glfw/src/lib.rs
+++ /dev/null
@@ -1,53 +0,0 @@
-#![deny(clippy::all, clippy::pedantic)]
-
-use std::ffi::{c_char, CStr};
-use std::ptr::null;
-
-mod ffi;
-mod init;
-mod util;
-
-pub mod window;
-
-pub use window::{Builder as WindowBuilder, Size as WindowSize, Window};
-
-#[derive(Debug, thiserror::Error)]
-pub enum Error
-{
- /// The current thread is not the main thread.
- #[error("The current thread is not the main thread")]
- NotInMainThread,
-
- /// An internal nul byte was found in a window title.
- #[error("An internal nul byte was found in the window title")]
- InternalNulByteInWindowTitle,
-
- #[error("This version of GLFW is unsupported")]
- UnsupportedVersion,
-
- /// GLFW error.
- #[error("GLFW error {0} occured. {1}")]
- GlfwError(i32, String),
-}
-
-fn get_glfw_error() -> Result<(), Error>
-{
- let mut description_ptr: *const c_char = null();
-
- let err = unsafe { crate::ffi::glfwGetError(&mut description_ptr) };
-
- if err == crate::ffi::GLFW_NO_ERROR {
- return Ok(());
- }
-
- // SAFETY: The description is guaranteed by GLFW to be valid UTF-8
- let desc_str = unsafe {
- std::str::from_utf8_unchecked(CStr::from_ptr(description_ptr).to_bytes())
- };
-
- // The description has to be copied because it is guaranteed to be valid only
- // until the next GLFW error occurs or the GLFW library is terminated.
- let description = desc_str.to_string();
-
- Err(Error::GlfwError(err, description))
-}