Skip to content

Commit

Permalink
any button triggers exit event
Browse files Browse the repository at this point in the history
- make every SDL_key count as exit button
- include exit logic also while music start to play
  • Loading branch information
Apaczer committed Feb 1, 2023
1 parent 01415ec commit b7b0ab4
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,8 @@ int main(int argc, char* argv[]) {
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_KEYDOWN:
switch(event.key.keysym.sym) {
case SDLK_LCTRL: // "B" button on PocketGO
exit(0);
break;
}
break;
}
}
rect.x = 0;
Expand All @@ -98,6 +94,15 @@ int main(int argc, char* argv[]) {
SDL_BlitSurface(logoimg, NULL, screen, &dstrect);
if (i == dest_y) {
Mix_PlayChannel(-1, logosound, 0);
while(1) {
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_KEYDOWN:
exit(0);
break;
}
}
}
}
while (curr_time < old_time + 16) {
curr_time = SDL_GetTicks();
Expand Down

0 comments on commit b7b0ab4

Please sign in to comment.