Skip to content

Commit

Permalink
On Mac OSX there are spurious hat events at program start, so skip these
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jan 17, 2020
1 parent 4e68246 commit 0a7fe18
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/controllermap.c
Expand Up @@ -415,6 +415,11 @@ WatchJoystick(SDL_Joystick * joystick)
s_nNumAxes = SDL_JoystickNumAxes(joystick);
s_arrAxisState = (AxisState *)SDL_calloc(s_nNumAxes, sizeof(*s_arrAxisState));

/* Skip any spurious events at start */
while (SDL_PollEvent(&event) > 0) {
continue;
}

/* Loop, getting joystick events! */
while (!done && !s_bBindingComplete) {
int iElement = s_arrBindingOrder[s_iCurrentBinding];
Expand Down

0 comments on commit 0a7fe18

Please sign in to comment.