test/testjoystick.c
changeset 6736 03dd4a1d06e9
parent 6733 cfef740efada
child 6747 b617821795bf
     1.1 --- a/test/testjoystick.c	Tue Dec 11 10:49:54 2012 -0800
     1.2 +++ b/test/testjoystick.c	Tue Dec 11 10:50:26 2012 -0800
     1.3 @@ -250,11 +250,17 @@
     1.4                  SDL_JoystickClose(joystick);
     1.5              }
     1.6  
     1.7 +            joystick = NULL;
     1.8              if (keepGoing) {
     1.9 -                joystick = NULL;
    1.10 -                SDL_WaitEvent( &event );
    1.11 -                if ( event.type == SDL_JOYDEVICEADDED ) {
    1.12 +                printf("Waiting for attach\n");
    1.13 +            }
    1.14 +            while (keepGoing) {
    1.15 +                SDL_WaitEvent(&event);
    1.16 +                if (event.type == SDL_QUIT) {
    1.17 +                    keepGoing = SDL_FALSE;
    1.18 +                } else if (event.type == SDL_JOYDEVICEADDED) {
    1.19                      joystick = SDL_JoystickOpen(atoi(argv[1]));
    1.20 +                    break;
    1.21                  }
    1.22              }
    1.23          }