Related to #1012.
This commit is contained in:
Camilla Löwy 2017-09-14 16:34:58 +02:00
parent 750ac64245
commit c4b73750b7
2 changed files with 23 additions and 20 deletions

View File

@ -959,7 +959,6 @@ GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* handle
GLFWAPI double glfwGetEventTime(void) GLFWAPI double glfwGetEventTime(void)
{ {
_GLFW_REQUIRE_INIT_OR_RETURN(0.0); _GLFW_REQUIRE_INIT_OR_RETURN(0.0);
return _glfwPlatformGetEventTime(); return _glfwPlatformGetEventTime();
} }

View File

@ -269,8 +269,8 @@ static void error_callback(int error, const char* description)
static void window_pos_callback(GLFWwindow* window, int x, int y) static void window_pos_callback(GLFWwindow* window, int x, int y)
{ {
Slot* slot = glfwGetWindowUserPointer(window); Slot* slot = glfwGetWindowUserPointer(window);
printf("%08x to %i at %0.3f (event time: %0.3f): Window position: %i %i\n", printf("%08x to %i at %0.3f: Window position: %i %i\n",
counter++, slot->number, glfwGetTime(), glfwGetEventTime(), x, y); counter++, slot->number, glfwGetTime(), x, y);
} }
static void window_size_callback(GLFWwindow* window, int width, int height) static void window_size_callback(GLFWwindow* window, int width, int height)
@ -336,33 +336,35 @@ static void window_maximize_callback(GLFWwindow* window, int maximized)
static void mouse_button_callback(GLFWwindow* window, int button, int action, int mods) static void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
{ {
Slot* slot = glfwGetWindowUserPointer(window); Slot* slot = glfwGetWindowUserPointer(window);
printf("%08x to %i at %0.3f (event time: %0.3f): Mouse button %i (%s) (with%s) was %s\n", printf("%08x to %i at %0.3f: Mouse button %i (%s) (with%s) was %s at %0.3f\n",
counter++, slot->number, glfwGetTime(), glfwGetEventTime(), button, counter++, slot->number, glfwGetTime(), button,
get_button_name(button), get_button_name(button),
get_mods_name(mods), get_mods_name(mods),
get_action_name(action)); get_action_name(action),
glfwGetEventTime());
} }
static void cursor_position_callback(GLFWwindow* window, double x, double y) static void cursor_position_callback(GLFWwindow* window, double x, double y)
{ {
Slot* slot = glfwGetWindowUserPointer(window); Slot* slot = glfwGetWindowUserPointer(window);
printf("%08x to %i at %0.3f (event time: %0.3f): Cursor position: %f %f\n", printf("%08x to %i at %0.3f: Cursor position: %f %f at %0.3f\n",
counter++, slot->number, glfwGetTime(), glfwGetEventTime(), x, y); counter++, slot->number, glfwGetTime(), x, y, glfwGetEventTime());
} }
static void cursor_enter_callback(GLFWwindow* window, int entered) static void cursor_enter_callback(GLFWwindow* window, int entered)
{ {
Slot* slot = glfwGetWindowUserPointer(window); Slot* slot = glfwGetWindowUserPointer(window);
printf("%08x to %i at %0.3f: Cursor %s window\n", printf("%08x to %i at %0.3f: Cursor %s window at %0.3f\n",
counter++, slot->number, glfwGetTime(), counter++, slot->number, glfwGetTime(),
entered ? "entered" : "left"); entered ? "entered" : "left",
glfwGetEventTime());
} }
static void scroll_callback(GLFWwindow* window, double x, double y) static void scroll_callback(GLFWwindow* window, double x, double y)
{ {
Slot* slot = glfwGetWindowUserPointer(window); Slot* slot = glfwGetWindowUserPointer(window);
printf("%08x to %i at %0.3f: Scroll: %0.3f %0.3f\n", printf("%08x to %i at %0.3f: Scroll: %0.3f %0.3f at %0.3f\n",
counter++, slot->number, glfwGetTime(), x, y); counter++, slot->number, glfwGetTime(), x, y, glfwGetEventTime());
} }
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)
@ -372,20 +374,22 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
if (name) if (name)
{ {
printf("%08x to %i at %0.3f (event time: %0.3f): Key 0x%04x Scancode 0x%04x (%s) (%s) (with%s) was %s\n", printf("%08x to %i at %0.3f: Key 0x%04x Scancode 0x%04x (%s) (%s) (with%s) was %s at %0.3f\n",
counter++, slot->number, glfwGetTime(), glfwGetEventTime(), key, scancode, counter++, slot->number, glfwGetTime(), key, scancode,
get_key_name(key), get_key_name(key),
name, name,
get_mods_name(mods), get_mods_name(mods),
get_action_name(action)); get_action_name(action),
glfwGetEventTime());
} }
else else
{ {
printf("%08x to %i at %0.3f (event time: %0.3f): Key 0x%04x Scancode 0x%04x (%s) (with%s) was %s\n", printf("%08x to %i at %0.3f: Key 0x%04x Scancode 0x%04x (%s) (with%s) was %s at %0.3f\n",
counter++, slot->number, glfwGetTime(), glfwGetEventTime(), key, scancode, counter++, slot->number, glfwGetTime(), key, scancode,
get_key_name(key), get_key_name(key),
get_mods_name(mods), get_mods_name(mods),
get_action_name(action)); get_action_name(action),
glfwGetEventTime());
} }
if (action != GLFW_PRESS) if (action != GLFW_PRESS)
@ -406,8 +410,8 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
static void char_callback(GLFWwindow* window, unsigned int codepoint) static void char_callback(GLFWwindow* window, unsigned int codepoint)
{ {
Slot* slot = glfwGetWindowUserPointer(window); Slot* slot = glfwGetWindowUserPointer(window);
printf("%08x to %i at %0.3f (event time: %0.3f): Character 0x%08x (%s) input\n", printf("%08x to %i at %0.3f: Character 0x%08x (%s) input\n",
counter++, slot->number, glfwGetTime(), glfwGetEventTime(), codepoint, counter++, slot->number, glfwGetTime(), codepoint,
get_character_string(codepoint)); get_character_string(codepoint));
} }