mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 00:51:47 +00:00
Clarify event test reporting of keys
Reshuffled line to group key-related items together. Omitted key code
output for unknown keys to put focus on the (lack of) name.
(cherry picked from commit d81fcb93f1
)
This commit is contained in:
parent
fafcba3824
commit
20bd0329a5
@ -393,25 +393,35 @@ static void scroll_callback(GLFWwindow* window, double x, double y)
|
|||||||
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
|
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||||
{
|
{
|
||||||
Slot* slot = glfwGetWindowUserPointer(window);
|
Slot* slot = glfwGetWindowUserPointer(window);
|
||||||
const char* name = glfwGetKeyName(key, scancode);
|
|
||||||
|
|
||||||
if (name)
|
if (key == GLFW_KEY_UNKNOWN)
|
||||||
{
|
{
|
||||||
printf("%08x to %i at %0.3f: Key 0x%04x Scancode 0x%04x (%s) (%s) (with%s) was %s\n",
|
printf("%08x to %i at %0.3f: Key (%s) Scancode 0x%04x (with%s) was %s\n",
|
||||||
counter++, slot->number, glfwGetTime(), key, scancode,
|
counter++, slot->number, glfwGetTime(),
|
||||||
get_key_name(key),
|
get_key_name(key), scancode,
|
||||||
name,
|
|
||||||
get_mods_name(mods),
|
get_mods_name(mods),
|
||||||
get_action_name(action));
|
get_action_name(action));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("%08x to %i at %0.3f: Key 0x%04x Scancode 0x%04x (%s) (with%s) was %s\n",
|
const char* name = glfwGetKeyName(key, scancode);
|
||||||
counter++, slot->number, glfwGetTime(), key, scancode,
|
if (name)
|
||||||
get_key_name(key),
|
{
|
||||||
|
printf("%08x to %i at %0.3f: Key 0x%04x (%s) Scancode 0x%04x Name %s (with%s) was %s\n",
|
||||||
|
counter++, slot->number, glfwGetTime(),
|
||||||
|
key, get_key_name(key), scancode, name,
|
||||||
get_mods_name(mods),
|
get_mods_name(mods),
|
||||||
get_action_name(action));
|
get_action_name(action));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("%08x to %i at %0.3f: Key 0x%04x (%s) Scancode 0x%04x (with%s) was %s\n",
|
||||||
|
counter++, slot->number, glfwGetTime(),
|
||||||
|
key, get_key_name(key), scancode,
|
||||||
|
get_mods_name(mods),
|
||||||
|
get_action_name(action));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (action != GLFW_PRESS)
|
if (action != GLFW_PRESS)
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user