Mercurial > molko
comparison libmlk-adventure/adventure/state/map.c @ 265:11db1d425502
adventure: catch EVENT_QUIT
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 09 Dec 2020 21:23:20 +0100 |
parents | 9bbbabb6f077 |
children | a49ae1b6ea4f |
comparison
equal
deleted
inserted
replaced
264:9bbbabb6f077 | 265:11db1d425502 |
---|---|
21 #include <assert.h> | 21 #include <assert.h> |
22 #include <stdlib.h> | 22 #include <stdlib.h> |
23 #include <stdio.h> | 23 #include <stdio.h> |
24 #include <string.h> | 24 #include <string.h> |
25 | 25 |
26 #include <core/event.h> | |
26 #include <core/image.h> | 27 #include <core/image.h> |
27 #include <core/painter.h> | 28 #include <core/painter.h> |
28 #include <core/panic.h> | 29 #include <core/panic.h> |
29 #include <core/state.h> | 30 #include <core/state.h> |
30 | 31 |
120 static void | 121 static void |
121 handle(struct state *state, const union event *ev) | 122 handle(struct state *state, const union event *ev) |
122 { | 123 { |
123 struct self *self = state->data; | 124 struct self *self = state->data; |
124 | 125 |
125 map_handle(&self->map, ev); | 126 if (ev->type == EVENT_QUIT) |
127 game_quit(); | |
128 else | |
129 map_handle(&self->map, ev); | |
126 } | 130 } |
127 | 131 |
128 static void | 132 static void |
129 update(struct state *state, unsigned int ticks) | 133 update(struct state *state, unsigned int ticks) |
130 { | 134 { |