- fixed joystick support a bit for analog joysticks, menu is still not really useable...
authorIngo Ruhnke <grumbel@gmx.de>
Sun, 18 Jan 2004 13:30:10 +0000 (13:30 +0000)
committerIngo Ruhnke <grumbel@gmx.de>
Sun, 18 Jan 2004 13:30:10 +0000 (13:30 +0000)
SVN-Revision: 96

src/gameloop.c
src/title.c

index 3f70658..b9f9596 100644 (file)
@@ -217,20 +217,21 @@ void game_event(void)
         switch(event.jaxis.axis)
            {
            case JOY_X:
-              if (event.jaxis.value < -256)
+             printf("X: %d\n", event.jaxis.value);
+              if (event.jaxis.value < -1024)
                 tux.input.left = DOWN;
-              else
+              else if (event.jaxis.value > 1024)
                 tux.input.left = UP;
 
-              if (event.jaxis.value > 256)
+              if (event.jaxis.value > 1024)
                 tux.input.right = DOWN;
-              else
+              else if (event.jaxis.value < -1024)
                 tux.input.right = UP;
             break;
           case JOY_Y:
-              if (event.jaxis.value > 256)
+              if (event.jaxis.value > 1024)
                 tux.input.down = DOWN;
-              else
+              else if (event.jaxis.value < -1024)
                 tux.input.down = UP;
 
               /* Handle joystick for the menu */
index 0c66575..a7f5a3e 100644 (file)
@@ -109,11 +109,11 @@ int title(void)
                 }
             }
 #ifdef JOY_YES
-          else if (event.type == SDL_JOYAXISMOTION)
+          else if (event.type == SDL_JOYAXISMOTION && event.jaxis.axis == JOY_Y)
             {
-              if (event.jaxis.value > 256)
+              if (event.jaxis.value > 1024)
                 menuaction = MN_DOWN;
-              else
+              else if (event.jaxis.value < -1024)
                 menuaction = MN_UP;
             }
           else if (event.type == SDL_JOYBUTTONDOWN)