Add glfwGetKeyName

Fixes #464.
This commit is contained in:
Camilla Berglund
2015-07-02 14:24:50 +02:00
parent 67c6a45e0e
commit 9c315412e1
19 changed files with 273 additions and 16 deletions

View File

@@ -192,6 +192,22 @@ void charmods_callback(GLFWwindow* window, unsigned int codepoint, int mods)
@endcode
@subsection input_key_name Key names
If you wish to refer to keys by name, you can query the keyboard layout
dependent name of printable keys with @ref glfwGetKeyName.
@code
const char* key_name = glfwGetKeyName(GLFW_KEY_W, 0);
show_tutorial_hint("Press %s to move forward", key_name);
@endcode
This function can handle both [keys and scancodes](@ref input_key). If the
specified key is `GLFW_KEY_UNKNOWN` then the scancode is used, otherwise it is
ignored. This matches the behavior of the key callback, meaning the callback
arguments can always be passed unmodified to this function.
@section input_mouse Mouse input
Mouse input comes in many forms, including cursor motion, button presses and

View File

@@ -11,6 +11,12 @@ GLFW now supports setting both absolute and relative window size limits with
@ref glfwSetWindowSizeLimits and @ref glfwSetWindowAspectRatio.
@subsection news_32_keyname Localized key names
GLFW now supports querying the localized name of printable keys with @ref
glfwGetKeyName, either by key token or by scancode.
@section news_31 New features in 3.1
These are the release highlights. For a full list of changes see the