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
+30
View File
@@ -414,6 +414,7 @@ extern "C" {
#define GLFW_KEY_RIGHT_ALT 346
#define GLFW_KEY_RIGHT_SUPER 347
#define GLFW_KEY_MENU 348
#define GLFW_KEY_LAST GLFW_KEY_MENU
/*! @} */
@@ -2588,6 +2589,33 @@ GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
*/
GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
/*! @brief Returns the localized name of the specified printable key.
*
* This function returns the localized name of the specified printable key.
*
* If the key is `GLFW_KEY_UNKNOWN`, the scancode is used, otherwise the
* scancode is ignored.
*
* @param[in] key The key to query, or `GLFW_KEY_UNKNOWN`.
* @param[in] scancode The scancode of the key to query.
* @return The localized name of the key.
*
* @par Pointer Lifetime
* The returned string is allocated and freed by GLFW. You should not free it
* yourself. It is valid until the next call to @ref glfwGetKeyName, or until
* the library is terminated.
*
* @par Thread Safety
* This function may only be called from the main thread.
*
* @sa @ref input_key_name
*
* @since Added in GLFW 3.2.
*
* @ingroup input
*/
GLFWAPI const char* glfwGetKeyName(int key, int scancode);
/*! @brief Returns the last reported state of a keyboard key for the specified
* window.
*
@@ -2607,6 +2635,8 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
* 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.