mirror of
https://github.com/glfw/glfw.git
synced 2024-11-25 14:04:36 +00:00
parent
0f341802e1
commit
7482de6071
@ -123,9 +123,21 @@ void key_callback(GLFWwindow* window, int key, int scancode, int action, int mod
|
|||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
The action is one of `GLFW_PRESS`, `GLFW_REPEAT` or `GLFW_RELEASE`. The key
|
The action is one of `GLFW_PRESS`, `GLFW_REPEAT` or `GLFW_RELEASE`. Events with
|
||||||
will be `GLFW_KEY_UNKNOWN` if GLFW lacks a key token for it, for example
|
`GLFW_PRESS` and `GLFW_RELEASE` actions are emitted for every key press. Most
|
||||||
_E-mail_ and _Play_ keys.
|
keys will also emit events with `GLFW_REPEAT` actions while a key is held down.
|
||||||
|
|
||||||
|
Key events with `GLFW_REPEAT` actions are intended for text input. They are
|
||||||
|
emitted at the rate set in the user's keyboard settings. At most one key is
|
||||||
|
repeated even if several keys are held down. `GLFW_REPEAT` actions should not
|
||||||
|
be relied on to know which keys are being held down or to drive animation.
|
||||||
|
Instead you should either save the state of relevant keys based on `GLFW_PRESS`
|
||||||
|
and `GLFW_RELEASE` actions, or call @ref glfwGetKey, which provides basic cached
|
||||||
|
key state.
|
||||||
|
|
||||||
|
The key will be one of the existing [key tokens](@ref keys), or
|
||||||
|
`GLFW_KEY_UNKNOWN` if GLFW lacks a token for it, for example _E-mail_ and _Play_
|
||||||
|
keys.
|
||||||
|
|
||||||
The scancode is unique for every key, regardless of whether it has a key token.
|
The scancode is unique for every key, regardless of whether it has a key token.
|
||||||
Scancodes are platform-specific but consistent over time, so keys will have
|
Scancodes are platform-specific but consistent over time, so keys will have
|
||||||
|
@ -4278,8 +4278,7 @@ GLFWAPI int glfwGetKeyScancode(int key);
|
|||||||
*
|
*
|
||||||
* This function returns the last state reported for the specified key to the
|
* This function returns the last state reported for the specified key to the
|
||||||
* specified window. The returned state is one of `GLFW_PRESS` or
|
* specified window. The returned state is one of `GLFW_PRESS` or
|
||||||
* `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to
|
* `GLFW_RELEASE`. The action `GLFW_REPEAT` is only reported to the key callback.
|
||||||
* the key callback.
|
|
||||||
*
|
*
|
||||||
* If the @ref GLFW_STICKY_KEYS input mode is enabled, this function returns
|
* 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
|
* `GLFW_PRESS` the first time you call it for a key that was pressed, even if
|
||||||
|
Loading…
Reference in New Issue
Block a user