From 7360e3086d5f3365813e8169bd17bcf347fa30c7 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 27 Nov 2023 22:15:33 +0100 Subject: docs(glfw): add InputMode & CursorMode doc comments --- glfw/src/window.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'glfw') diff --git a/glfw/src/window.rs b/glfw/src/window.rs index bd8b78b..b1c94a2 100644 --- a/glfw/src/window.rs +++ b/glfw/src/window.rs @@ -365,9 +365,31 @@ pub struct Size #[repr(i32)] pub enum InputMode { + /// When sticky keys mode is enabled, the pollable state of a key will remain + /// [`KeyState::Pressed`] until the state of that key is polled with + /// [`Window::get_key`]. Once it has been polled, if a key release event had been + /// processed in the meantime, the state will reset to [`KeyState::Released`], + /// otherwise it will remain [`KeyState::Pressed`]. StickyKeys = crate::ffi::GLFW_STICKY_KEYS, + + /// When sticky mouse buttons mode is enabled, the pollable state of a mouse button + /// will remain [`MouseButtonState::Pressed`] until the state of that button is + /// polled with [`Window::get_mouse_button`]. Once it has been polled, if a mouse + /// button release event had been processed in the meantime, the state will reset + /// to [`MouseButtonState::Released`], otherwise it will remain + /// [`MouseButton::Pressed`]. StickyMouseButtons = crate::ffi::GLFW_STICKY_MOUSE_BUTTONS, + LockKeyMods = crate::ffi::GLFW_LOCK_KEY_MODS, + + /// When the cursor is disabled, raw (unscaled and unaccelerated) mouse motion can be + /// enabled if available. + /// + /// Raw mouse motion is closer to the actual motion of the mouse across a surface. It + /// is not affected by the scaling and acceleration applied to the motion of the + /// desktop cursor. That processing is suitable for a cursor while raw motion is + /// better for controlling for example a 3D camera. Because of this, raw mouse motion + /// is only provided when the cursor is disabled. RawMouseMotion = crate::ffi::GLFW_RAW_MOUSE_MOTION, } @@ -375,8 +397,15 @@ pub enum InputMode #[repr(i32)] pub enum CursorMode { + /// Hides and grabs the cursor, providing virtual and unlimited cursor movement. This + /// is useful for implementing for example 3D camera controls. Disabled = crate::ffi::GLFW_CURSOR_DISABLED, + + /// Makes the cursor invisible when it is over the content area of the window but + /// does not restrict the cursor from leaving. Hidden = crate::ffi::GLFW_CURSOR_HIDDEN, + + /// Makes the cursor visible and behaving normally. Normal = crate::ffi::GLFW_CURSOR_NORMAL, } -- cgit v1.2.3-18-g5258