浏览代码

Fix joystick test attention request

Fixes #1020.
Camilla Löwy 8 年之前
父节点
当前提交
bc7ebc1a89
共有 1 个文件被更改,包括 8 次插入8 次删除
  1. 8 8
      tests/joysticks.c

+ 8 - 8
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;