summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2022-10-17 22:10:30 -0700
committerVito Caputo <vcaputo@pengaru.com>2022-10-17 22:10:30 -0700
commit03573cb045197f8e1507b5a6c1289ce71e9857ff (patch)
tree1b38384c2f9afcfe899713c93c41520b7242e57b /src
parente37d85075376ed03bb02266134de7ff7301faa75 (diff)
hungrycat: skip hungrycat on {key,finger}down
splash screen bypasses for the impatient escape quits splash now as well
Diffstat (limited to 'src')
-rw-r--r--src/hungrycat.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/hungrycat.c b/src/hungrycat.c
index 8457d8a..2e22de9 100644
--- a/src/hungrycat.c
+++ b/src/hungrycat.c
@@ -147,11 +147,31 @@ static void hungrycat_leave(play_t *play, void *context)
}
+static void hungrycat_dispatch(play_t *play, void *context, SDL_Event *event)
+{
+ /* global handlers */
+ sars_dispatch(play, context, event);
+
+ switch (event->type) {
+ case SDL_KEYDOWN:
+ if (event->key.keysym.sym == SDLK_ESCAPE)
+ exit(0);
+ /* fallthrough */
+ case SDL_FINGERDOWN:
+ play_context_enter(play, SARS_CONTEXT_GAME);
+ break;
+
+ default:
+ break;
+ }
+}
+
+
const play_ops_t hungrycat_ops = {
.init = hungrycat_init,
.update = hungrycat_update,
.render = sars_render,
- .dispatch = sars_dispatch,
+ .dispatch = hungrycat_dispatch,
.enter = hungrycat_enter,
.leave = hungrycat_leave,
};
© All Rights Reserved