mirror of
https://github.com/yawut/SDL.git
synced 2026-09-12 19:16:42 -05:00
You can get window events after shutting down the window, so don't abort the program if that happens.
This commit is contained in:
@@ -250,11 +250,17 @@ main(int argc, char *argv[])
|
||||
SDL_JoystickClose(joystick);
|
||||
}
|
||||
|
||||
joystick = NULL;
|
||||
if (keepGoing) {
|
||||
joystick = NULL;
|
||||
SDL_WaitEvent( &event );
|
||||
if ( event.type == SDL_JOYDEVICEADDED ) {
|
||||
printf("Waiting for attach\n");
|
||||
}
|
||||
while (keepGoing) {
|
||||
SDL_WaitEvent(&event);
|
||||
if (event.type == SDL_QUIT) {
|
||||
keepGoing = SDL_FALSE;
|
||||
} else if (event.type == SDL_JOYDEVICEADDED) {
|
||||
joystick = SDL_JoystickOpen(atoi(argv[1]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user