Make adding more printable keys slightly easier

When adding keys after `GLFW_KEY_UNDERSCORE`, one now needs to change a `#define` right below the last printable key instead of changing it elsewhere in the code.
This commit now also marks `GLFW_KEY_PLUS` and `GLFW_KEY_UNDERSCORE` as printable characters.
This commit is contained in:
Luflosi
2019-08-31 21:51:26 +02:00
parent def0c55df3
commit b3b830bb5f
4 changed files with 6 additions and 2 deletions

2
glfw/glfw3.h vendored
View File

@@ -394,6 +394,8 @@ extern "C" {
#define GLFW_KEY_PLUS 163
#define GLFW_KEY_UNDERSCORE 164
#define GLFW_KEY_LAST_PRINTABLE GLFW_KEY_UNDERSCORE
/* Function keys */
#define GLFW_KEY_ESCAPE 256
#define GLFW_KEY_ENTER 257

2
glfw/input.c vendored
View File

@@ -691,7 +691,7 @@ GLFWAPI const char* glfwGetKeyName(int key, int scancode)
{
if (key != GLFW_KEY_KP_EQUAL &&
(key < GLFW_KEY_KP_0 || key > GLFW_KEY_KP_ADD) &&
(key < GLFW_KEY_APOSTROPHE || key > GLFW_KEY_WORLD_2))
(key < GLFW_KEY_APOSTROPHE || key > GLFW_KEY_LAST_PRINTABLE))
{
return NULL;
}