[go: up one dir, main page]

glfwGetKey

Function glfwGetKey 

Source
pub unsafe extern "C" fn glfwGetKey(
    window: *mut GLFWwindow,
    key: i32,
) -> i32
Expand description

@brief Returns the last reported state of a keyboard key for the specified window.

This function returns the last state reported for the specified key to the specified window. The returned state is one of GLFW_PRESS or GLFW_RELEASE. The action GLFW_REPEAT is only reported to the key callback.

If the @ref GLFW_STICKY_KEYS input mode is enabled, this function returns GLFW_PRESS the first time you call it for a key that was pressed, even if that key has already been released.

The key functions deal with physical keys, with [key tokens](@ref keys) named after their use on the standard US keyboard layout. If you want to input text, use the Unicode character callback instead.

The [modifier key bit masks](@ref mods) are not key tokens and cannot be used with this function.

Do not use this function to implement [text input](@ref input_char).

@param[in] window The desired window. @param[in] key The desired [keyboard key](@ref keys). GLFW_KEY_UNKNOWN is not a valid key for this function. @return One of GLFW_PRESS or GLFW_RELEASE.

@errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref GLFW_INVALID_ENUM.

@thread_safety This function must only be called from the main thread.

@sa @ref input_key

@since Added in version 1.0. @glfw3 Added window handle parameter.

@ingroup input