From bc7ebc1a896c6e4f599f155966f5b029c157ba51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 22 May 2017 15:16:47 +0200 Subject: [PATCH] Fix joystick test attention request Fixes #1020. --- tests/joysticks.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/joysticks.c b/tests/joysticks.c index 263bcb1c..3a7a90c7 100644 --- a/tests/joysticks.c +++ b/tests/joysticks.c @@ -105,14 +105,6 @@ int main(void) if (!glfwInit()) exit(EXIT_FAILURE); - for (jid = GLFW_JOYSTICK_1; jid <= GLFW_JOYSTICK_LAST; jid++) - { - if (glfwJoystickPresent(jid)) - joystick_callback(jid, GLFW_CONNECTED); - } - - glfwSetJoystickCallback(joystick_callback); - window = glfwCreateWindow(640, 480, "Joystick Test", NULL, NULL); if (!window) { @@ -128,6 +120,14 @@ int main(void) nk_glfw3_font_stash_begin(&atlas); nk_glfw3_font_stash_end(); + for (jid = GLFW_JOYSTICK_1; jid <= GLFW_JOYSTICK_LAST; jid++) + { + if (glfwJoystickPresent(jid)) + joysticks[joystick_count++] = jid; + } + + glfwSetJoystickCallback(joystick_callback); + while (!glfwWindowShouldClose(window)) { int i, width, height;