Merge commit '26c8cc348eacea01237cd64e1a68d0df8141e848'
This commit is contained in:
59
deps/glfw/tests/events.c
vendored
59
deps/glfw/tests/events.c
vendored
@@ -31,6 +31,7 @@
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#define GLAD_GL_IMPLEMENTATION
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
@@ -320,6 +321,12 @@ static void window_close_callback(GLFWwindow* window)
|
||||
printf("%08x to %i at %0.3f: Window close\n",
|
||||
counter++, slot->number, glfwGetTime());
|
||||
|
||||
if (!slot->closeable)
|
||||
{
|
||||
printf("(( closing is disabled, press %s to re-enable )\n",
|
||||
glfwGetKeyName(GLFW_KEY_C, 0));
|
||||
}
|
||||
|
||||
glfwSetWindowShouldClose(window, slot->closeable);
|
||||
}
|
||||
|
||||
@@ -393,24 +400,34 @@ static void scroll_callback(GLFWwindow* window, double x, double y)
|
||||
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||
{
|
||||
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",
|
||||
counter++, slot->number, glfwGetTime(), key, scancode,
|
||||
get_key_name(key),
|
||||
name,
|
||||
get_mods_name(mods),
|
||||
get_action_name(action));
|
||||
printf("%08x to %i at %0.3f: Key (%s) Scancode 0x%04x (with%s) was %s\n",
|
||||
counter++, slot->number, glfwGetTime(),
|
||||
get_key_name(key), scancode,
|
||||
get_mods_name(mods),
|
||||
get_action_name(action));
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%08x to %i at %0.3f: Key 0x%04x Scancode 0x%04x (%s) (with%s) was %s\n",
|
||||
counter++, slot->number, glfwGetTime(), key, scancode,
|
||||
get_key_name(key),
|
||||
get_mods_name(mods),
|
||||
get_action_name(action));
|
||||
const char* name = glfwGetKeyName(key, scancode);
|
||||
if (name)
|
||||
{
|
||||
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_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)
|
||||
@@ -503,6 +520,20 @@ static void joystick_callback(int jid, int event)
|
||||
axisCount,
|
||||
buttonCount,
|
||||
hatCount);
|
||||
|
||||
if (glfwJoystickIsGamepad(jid))
|
||||
{
|
||||
printf(" Joystick %i (%s) has a gamepad mapping (%s)\n",
|
||||
jid,
|
||||
glfwGetJoystickGUID(jid),
|
||||
glfwGetGamepadName(jid));
|
||||
}
|
||||
else
|
||||
{
|
||||
printf(" Joystick %i (%s) has no gamepad mapping\n",
|
||||
jid,
|
||||
glfwGetJoystickGUID(jid));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -621,7 +652,7 @@ int main(int argc, char** argv)
|
||||
|
||||
glfwMakeContextCurrent(slots[i].window);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
glfwSwapInterval(1);
|
||||
glfwSwapBuffers(slots[i].window);
|
||||
}
|
||||
|
||||
printf("Main loop starting\n");
|
||||
|
Reference in New Issue
Block a user