glfwGetKey¶
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 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
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
are not key tokens and cannot be
used with this function.
Do not use this function to implement text input
.
- arguments
-
\GLFWwindow
$window
The desired window.int
$key
The desiredkeyboard key
.GLFW_KEY_UNKNOWN
is not a valid key for this function.
- returns
-
int
One ofGLFW_PRESS
orGLFW_RELEASE
.