glfwSetInputMode function
! @brief Sets an input option for the specified window.
This function sets an input mode option for the specified window. The mode must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS, @ref GLFW_STICKY_MOUSE_BUTTONS, @ref GLFW_LOCK_KEY_MODS or @ref GLFW_RAW_MOUSE_MOTION.
If the mode is GLFW_CURSOR
, the value must be one of the following cursor
modes:
GLFW_CURSOR_NORMAL
makes the cursor visible and behaving normally.GLFW_CURSOR_HIDDEN
makes the cursor invisible when it is over the content area of the window but does not restrict the cursor from leaving.GLFW_CURSOR_DISABLED
hides and grabs the cursor, providing virtual and unlimited cursor movement. This is useful for implementing for example 3D camera controls.
If the mode is GLFW_STICKY_KEYS
, the value must be either GLFW_TRUE
to
enable sticky keys, or GLFW_FALSE
to disable it. If sticky keys are
enabled, a key press will ensure that @ref glfwGetKey returns GLFW_PRESS
the next time it is called even if the key had been released before the
call. This is useful when you are only interested in whether keys have been
pressed but not when or in which order.
If the mode is GLFW_STICKY_MOUSE_BUTTONS
, the value must be either
GLFW_TRUE
to enable sticky mouse buttons, or GLFW_FALSE
to disable it.
If sticky mouse buttons are enabled, a mouse button press will ensure that
@ref glfwGetMouseButton returns GLFW_PRESS
the next time it is called even
if the mouse button had been released before the call. This is useful when
you are only interested in whether mouse buttons have been pressed but not
when or in which order.
If the mode is GLFW_LOCK_KEY_MODS
, the value must be either GLFW_TRUE
to
enable lock key modifier bits, or GLFW_FALSE
to disable them. If enabled,
callbacks that receive modifier bits will also have the @ref
GLFW_MOD_CAPS_LOCK bit set when the event was generated with Caps Lock on,
and the @ref GLFW_MOD_NUM_LOCK bit when Num Lock was on.
If the mode is GLFW_RAW_MOUSE_MOTION
, the value must be either GLFW_TRUE
to enable raw (unscaled and unaccelerated) mouse motion when the cursor is
disabled, or GLFW_FALSE
to disable it. If raw motion is not supported,
attempting to set this will emit @ref GLFW_PLATFORM_ERROR. Call @ref
glfwRawMouseMotionSupported to check for support.
@paramin
window The window whose input mode to set.
@paramin
mode One of GLFW_CURSOR
, GLFW_STICKY_KEYS
,
GLFW_STICKY_MOUSE_BUTTONS
, GLFW_LOCK_KEY_MODS
or
GLFW_RAW_MOUSE_MOTION
.
@paramin
value The new value of the specified input mode.
@errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
@thread_safety This function must only be called from the main thread.
@sa @ref glfwGetInputMode
@since Added in version 3.0. Replaces glfwEnable
and glfwDisable
.
@ingroup input
GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value)
Implementation
void glfwSetInputMode(Pointer<GLFWwindow> window, int mode, int value) {
final glfwSetInputModeLookupFunction = libglfw.lookupFunction<
Void Function(Pointer<GLFWwindow> window, Int32 mode, Int32 value),
void Function(
Pointer<GLFWwindow> window, int mode, int value)>('glfwSetInputMode');
return glfwSetInputModeLookupFunction(window, mode, value);
}