Browse Source

controllermap: Don't treat SDL_HAT_CENTERED as a valid input.

Ryan C. Gordon 11 years ago
parent
commit
1f45d4b614
1 changed files with 3 additions and 0 deletions
  1. 3 0
      test/controllermap.c

+ 3 - 0
test/controllermap.c

@@ -251,6 +251,9 @@ WatchJoystick(SDL_Joystick * joystick)
                     
                     break;
                 case SDL_JOYHATMOTION:
+                        if (event.jhat.value == SDL_HAT_CENTERED) {
+                            break;  /* ignore centering, we're probably just coming back to the center from the previous item we set. */
+                        }
                         for (_s = 0; _s < s; _s++) {
                             if (steps[_s].hat == event.jhat.hat && steps[_s].hat_value == event.jhat.value) {
                                 break;