return to menu with MENU

This commit is contained in:
KikooDX 2021-05-06 00:13:14 +02:00
parent a11b9d1c52
commit 88b1ac790a
2 changed files with 10 additions and 2 deletions

View File

@ -9,7 +9,7 @@ input_init(void)
{
struct Input input = {
.keycodes = {KEY_LEFT, KEY_RIGHT, KEY_UP, KEY_DOWN, KEY_SHIFT,
KEY_MENU},
KEY_EXIT},
};
int i = KEYS_COUNT;
while (i-- > 0)

View File

@ -90,7 +90,7 @@ main(void)
player = player_init();
/* main game loop */
while (!keydown(KEY_EXIT)) {
while (1) {
/* skip render frames */
i = 1 + frameskip;
while (i-- > 0) {
@ -243,6 +243,14 @@ main(void)
break;
}
dupdate();
/* return to main menu */
/* TODO don't hardcode this */
if (keydown(KEY_MENU)) {
gint_osmenu();
if (game_state == Playing)
game_state = GamePause;
}
}
timer_stop(timer);