Mercurial > molko
changeset 265:11db1d425502
adventure: catch EVENT_QUIT
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 09 Dec 2020 21:23:20 +0100 |
parents | 9bbbabb6f077 |
children | e48ffbcf9bcc |
files | libmlk-adventure/adventure/molko.c libmlk-adventure/adventure/state/mainmenu.c libmlk-adventure/adventure/state/map.c |
diffstat | 3 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/libmlk-adventure/adventure/molko.c Wed Dec 09 21:22:21 2020 +0100 +++ b/libmlk-adventure/adventure/molko.c Wed Dec 09 21:23:20 2020 +0100 @@ -79,8 +79,7 @@ panic_handler = crash; /* Start to splash. */ - //game_switch(splashscreen_state_new(), true); - game_switch(mainmenu_state_new(), true); + game_switch(splashscreen_state_new(), true); } void
--- a/libmlk-adventure/adventure/state/mainmenu.c Wed Dec 09 21:22:21 2020 +0100 +++ b/libmlk-adventure/adventure/state/mainmenu.c Wed Dec 09 21:23:20 2020 +0100 @@ -141,6 +141,9 @@ struct self *self = state->data; switch (event->type) { + case EVENT_QUIT: + game_quit(); + break; case EVENT_KEYDOWN: switch (event->key.key) { case KEY_UP:
--- a/libmlk-adventure/adventure/state/map.c Wed Dec 09 21:22:21 2020 +0100 +++ b/libmlk-adventure/adventure/state/map.c Wed Dec 09 21:23:20 2020 +0100 @@ -23,6 +23,7 @@ #include <stdio.h> #include <string.h> +#include <core/event.h> #include <core/image.h> #include <core/painter.h> #include <core/panic.h> @@ -122,7 +123,10 @@ { struct self *self = state->data; - map_handle(&self->map, ev); + if (ev->type == EVENT_QUIT) + game_quit(); + else + map_handle(&self->map, ev); } static void