From 6cdb24ee9446cb0f19e7de8ac6d7db31a889b657 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Thu, 8 Dec 2022 21:17:45 -0800 Subject: 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. --- src/game.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/game.c') 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; } -- cgit v1.2.3