mirror of
https://github.com/glfw/glfw.git
synced 2026-01-11 15:23:17 +01:00
Improve documentation relating to key tokens
Shifted the documentation away from the term 'named keys' as something different than keys that glfwGetKeyName will return a name for. The already existing term 'key token' should now be used to refer to the GLFW_KEY_* constants. The associated term 'named mouse button' was also replaced with 'supported mouse button'. The parts explaining which key tokens will return a valid scancode from glfwGetKeyScancode have hopefully been clarified. This issue was reported in #2055. The GLFW_KEY_UNKNOWN constant has been moved out of the list of key tokens to simplify and hopefully clarify the related documentation. Various other keyboard key related edits were made, hopefully resulting in improvements. Related to #2055
This commit is contained in:
@@ -361,10 +361,15 @@ extern "C" {
|
||||
#define GLFW_HAT_RIGHT_DOWN (GLFW_HAT_RIGHT | GLFW_HAT_DOWN)
|
||||
#define GLFW_HAT_LEFT_UP (GLFW_HAT_LEFT | GLFW_HAT_UP)
|
||||
#define GLFW_HAT_LEFT_DOWN (GLFW_HAT_LEFT | GLFW_HAT_DOWN)
|
||||
|
||||
/*! @ingroup input
|
||||
*/
|
||||
#define GLFW_KEY_UNKNOWN -1
|
||||
|
||||
/*! @} */
|
||||
|
||||
/*! @defgroup keys Keyboard keys
|
||||
* @brief Keyboard key IDs.
|
||||
/*! @defgroup keys Keyboard key tokens
|
||||
* @brief Keyboard key tokens.
|
||||
*
|
||||
* See [key input](@ref input_key) for how these are used.
|
||||
*
|
||||
@@ -387,9 +392,6 @@ extern "C" {
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* The unknown key */
|
||||
#define GLFW_KEY_UNKNOWN -1
|
||||
|
||||
/* Printable keys */
|
||||
#define GLFW_KEY_SPACE 32
|
||||
#define GLFW_KEY_APOSTROPHE 39 /* ' */
|
||||
@@ -4741,15 +4743,18 @@ GLFWAPI const char* glfwGetKeyName(int key, int scancode);
|
||||
*
|
||||
* This function returns the platform-specific scancode of the specified key.
|
||||
*
|
||||
* If the key is `GLFW_KEY_UNKNOWN` or does not exist on the keyboard this
|
||||
* method will return `-1`.
|
||||
* If the specified [key token](@ref keys) corresponds to a physical key not
|
||||
* supported on the current platform then this method will return `-1`.
|
||||
* Calling this function with anything other than a key token will return `-1`
|
||||
* and generate a @ref GLFW_INVALID_ENUM error.
|
||||
*
|
||||
* @param[in] key Any [named key](@ref keys).
|
||||
* @return The platform-specific scancode for the key, or `-1` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
* @param[in] key Any [key token](@ref keys).
|
||||
* @return The platform-specific scancode for the key, or `-1` if the key is
|
||||
* not supported on the current platform or an [error](@ref error_handling)
|
||||
* occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||
* GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_INVALID_ENUM.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread.
|
||||
*
|
||||
@@ -5058,9 +5063,9 @@ GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
|
||||
* [character callback](@ref glfwSetCharCallback) instead.
|
||||
*
|
||||
* When a window loses input focus, it will generate synthetic key release
|
||||
* events for all pressed named keys. You can tell these events from
|
||||
* user-generated events by the fact that the synthetic ones are generated
|
||||
* after the focus loss event has been processed, i.e. after the
|
||||
* events for all pressed keys with associated key tokens. You can tell these
|
||||
* events from user-generated events by the fact that the synthetic ones are
|
||||
* generated after the focus loss event has been processed, i.e. after the
|
||||
* [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
|
||||
*
|
||||
* The scancode of a key is specific to that platform or sometimes even to that
|
||||
|
||||
Reference in New Issue
Block a user