mirror of
https://github.com/glfw/glfw.git
synced 2026-02-17 21:12:34 +01:00
Added scancode to key callback.
This commit is contained in:
@@ -172,6 +172,7 @@ static const char* get_key_name(int key)
|
||||
case GLFW_KEY_LEFT_SUPER: return "LEFT SUPER";
|
||||
case GLFW_KEY_RIGHT_SUPER: return "RIGHT SUPER";
|
||||
case GLFW_KEY_MENU: return "MENU";
|
||||
case GLFW_KEY_UNKNOWN: return "UNKNOWN";
|
||||
|
||||
default: return NULL;
|
||||
}
|
||||
@@ -339,11 +340,12 @@ static void scroll_callback(GLFWwindow* window, double x, double y)
|
||||
printf("%08x at %0.3f: Scroll: %0.3f %0.3f\n", counter++, glfwGetTime(), x, y);
|
||||
}
|
||||
|
||||
static void key_callback(GLFWwindow* window, int key, int action, int mods)
|
||||
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||
{
|
||||
const char* name = get_key_name(key);
|
||||
|
||||
printf("%08x at %0.3f: Key 0x%04x", counter++, glfwGetTime(), key);
|
||||
printf("%08x at %0.3f: Key 0x%04x Scancode 0x%04x",
|
||||
counter++, glfwGetTime(), key, scancode);
|
||||
|
||||
if (name)
|
||||
printf(" (%s)", name);
|
||||
|
||||
Reference in New Issue
Block a user