You can get window events after shutting down the window, so don't abort the program if that happens.
This commit is contained in:
parent
5417afcf11
commit
a8fab2d5bf
1 changed files with 9 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue