Added scancode to key callback.

This commit is contained in:
Camilla Berglund
2013-05-30 17:19:12 +02:00
parent 362bf5de64
commit 11615fcaf2
25 changed files with 125 additions and 100 deletions

View File

@@ -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);