summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2022-12-08 21:17:45 -0800
committerVito Caputo <vcaputo@pengaru.com>2022-12-10 13:47:39 -0800
commit6cdb24ee9446cb0f19e7de8ac6d7db31a889b657 (patch)
treeb675d003c1dbb7ebd3348128a8e7572e77d4074d
parentef21bf2bccd6f5e0e70b8a74d68ffea537e7dd44 (diff)
game: leave game over waits on WASD and arrow keys too
I'd added SPACE and RETURN, but as those aren't used anywhere else in sars it's unintuitive to require those spuriously, and there's a good chance someone will reach for ESC first which will quit the game instead of restarting.
-rw-r--r--src/game.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/game.c b/src/game.c
index fa5d33d..1c05ed8 100644
--- a/src/game.c
+++ b/src/game.c
@@ -1274,8 +1274,18 @@ static void game_dispatch(play_t *play, void *context, SDL_Event *event)
if (event->key.keysym.sym == SDLK_ESCAPE)
exit(0);
- if ((event->key.keysym.sym == SDLK_SPACE || event->key.keysym.sym == SDLK_RETURN) &&
- (game->state == GAME_STATE_OVER_WAITING || game->state == GAME_STATE_OVER_WINNING_WAITING)) {
+ if ((game->state == GAME_STATE_OVER_WAITING ||
+ game->state == GAME_STATE_OVER_WINNING_WAITING) &&
+ (event->key.keysym.sym == SDLK_SPACE ||
+ event->key.keysym.sym == SDLK_RETURN ||
+ event->key.keysym.sym == SDLK_w ||
+ event->key.keysym.sym == SDLK_a ||
+ event->key.keysym.sym == SDLK_s ||
+ event->key.keysym.sym == SDLK_d ||
+ event->key.keysym.sym == SDLK_RIGHT ||
+ event->key.keysym.sym == SDLK_LEFT ||
+ event->key.keysym.sym == SDLK_DOWN ||
+ event->key.keysym.sym == SDLK_UP)) {
reset_game(play, game);
break;
}
© All Rights Reserved