From 74fdeb71a16d30b3ef2511ee7a2509eae7f3b4f3 Mon Sep 17 00:00:00 2001 From: Shadow15510 Date: Wed, 19 Jan 2022 21:06:16 +0100 Subject: [PATCH] Review ergonomy --- src/core.c | 8 ++++---- src/main.c | 2 +- src/mutation_engine.c | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/core.c b/src/core.c index e77469e..a51aa47 100644 --- a/src/core.c +++ b/src/core.c @@ -100,12 +100,12 @@ int get_inputs(const int background, int *mutation_menu, int *boost) return 2; } - if (key == KEY_ALPHA) + if (key == KEY_ALPHA || key == KEY_EXIT) { if (background == 4) return 2; + if (background == 1) return -1; else return 1; } - if (key == KEY_EXIT && background == 1) return -1; if (background == 2) { @@ -141,7 +141,7 @@ int rtc_key(void) int timeout = 1; key_event_t ev = getkey_opt(opt, &timeout); - if(ev.type == KEYEV_NONE) return 0; + if (ev.type == KEYEV_NONE) return 0; return ev.key; } @@ -160,5 +160,5 @@ void message(char *msg) key_event_t ev = {0}; display_message(msg); - while (ev.key != KEY_ALPHA) ev = getkey_opt(opt, NULL); + while (ev.key != KEY_ALPHA && ev.key != KEY_EXIT) ev = getkey_opt(opt, NULL); } diff --git a/src/main.c b/src/main.c index 8078751..6204439 100644 --- a/src/main.c +++ b/src/main.c @@ -20,7 +20,7 @@ #include "mutation_engine.h" #include "save.h" -const char *VERSION = "1.3.9"; +const char *VERSION = "1.3.10"; // title_screen : display the title screen static void title_screen(void); diff --git a/src/mutation_engine.c b/src/mutation_engine.c index fb8fb30..a9b6269 100644 --- a/src/mutation_engine.c +++ b/src/mutation_engine.c @@ -76,7 +76,7 @@ void mutation_select(struct game *current_game, const int mutation_menu) if (key) {tick = 1; c.display = 1;} // Manage input - if (key == KEY_ALPHA) end = 1; + if (key == KEY_ALPHA || key == KEY_EXIT) end = 1; if (key == KEY_SHIFT && table[c.y][c.x] != 15 && table[c.y][c.x] != 0) { mutation_buy(current_game, c, mutation_menu, table); @@ -111,11 +111,11 @@ void mutation_buy(struct game *current_game, const struct cursor c, const int mu key = ev.key; if (key == KEY_DOWN || key == KEY_UP) button_selected = (button_selected + 1) % 2; - if (key == KEY_ALPHA) break; + if (key == KEY_ALPHA || key == KEY_EXIT) break; if (key == KEY_OPTN) { display_mutation_description(mutation_data->name, mutation_data->description, mutation_menu, id); - while (ev.key != KEY_ALPHA) ev = getkey_opt(opt, NULL); + while (ev.key != KEY_ALPHA && ev.key != KEY_EXIT) ev = getkey_opt(opt, NULL); } if (key == KEY_SHIFT) {