add: multiple menu keybinds

This commit is contained in:
spykyvenator 2024-03-01 12:00:26 +01:00
parent 90702ce171
commit 04008d76b9
3 changed files with 22 additions and 4 deletions

View file

@ -544,6 +544,16 @@ void game_init(void) {
input_bind(INPUT_LAYER_SYSTEM, INPUT_KEY_LEFT, A_MENU_LEFT); input_bind(INPUT_LAYER_SYSTEM, INPUT_KEY_LEFT, A_MENU_LEFT);
input_bind(INPUT_LAYER_SYSTEM, INPUT_KEY_RIGHT, A_MENU_RIGHT); input_bind(INPUT_LAYER_SYSTEM, INPUT_KEY_RIGHT, A_MENU_RIGHT);
input_bind(INPUT_LAYER_SYSTEM, INPUT_KEY_W, A_MENU_UP_2);
input_bind(INPUT_LAYER_SYSTEM, INPUT_KEY_S, A_MENU_DOWN_2);
input_bind(INPUT_LAYER_SYSTEM, INPUT_KEY_A, A_MENU_LEFT_2);
input_bind(INPUT_LAYER_SYSTEM, INPUT_KEY_D, A_MENU_RIGHT_2);
input_bind(INPUT_LAYER_SYSTEM, INPUT_KEY_K, A_MENU_UP_3);
input_bind(INPUT_LAYER_SYSTEM, INPUT_KEY_J, A_MENU_DOWN_3);
input_bind(INPUT_LAYER_SYSTEM, INPUT_KEY_H, A_MENU_LEFT_3);
input_bind(INPUT_LAYER_SYSTEM, INPUT_KEY_L, A_MENU_RIGHT_3);
input_bind(INPUT_LAYER_SYSTEM, INPUT_KEY_BACKSPACE, A_MENU_BACK); input_bind(INPUT_LAYER_SYSTEM, INPUT_KEY_BACKSPACE, A_MENU_BACK);
input_bind(INPUT_LAYER_SYSTEM, INPUT_KEY_C, A_MENU_BACK); input_bind(INPUT_LAYER_SYSTEM, INPUT_KEY_C, A_MENU_BACK);
input_bind(INPUT_LAYER_SYSTEM, INPUT_KEY_V, A_MENU_BACK); input_bind(INPUT_LAYER_SYSTEM, INPUT_KEY_V, A_MENU_BACK);

View file

@ -35,6 +35,14 @@ typedef enum {
A_MENU_DOWN, A_MENU_DOWN,
A_MENU_LEFT, A_MENU_LEFT,
A_MENU_RIGHT, A_MENU_RIGHT,
A_MENU_UP_2,
A_MENU_DOWN_2,
A_MENU_LEFT_2,
A_MENU_RIGHT_2,
A_MENU_UP_3,
A_MENU_DOWN_3,
A_MENU_LEFT_3,
A_MENU_RIGHT_3,
A_MENU_BACK, A_MENU_BACK,
A_MENU_SELECT, A_MENU_SELECT,
A_MENU_START, A_MENU_START,

View file

@ -86,18 +86,18 @@ void menu_update(menu_t *menu) {
int selected_data = 0; int selected_data = 0;
if (page->entries_len > 0) { if (page->entries_len > 0) {
if (flags_is(page->layout_flags, MENU_HORIZONTAL)) { if (flags_is(page->layout_flags, MENU_HORIZONTAL)) {
if (input_pressed(A_MENU_LEFT)) { if (input_pressed(A_MENU_LEFT) || input_pressed(A_MENU_LEFT_2) || input_pressed(A_MENU_LEFT_3)) {
page->index--; page->index--;
} }
else if (input_pressed(A_MENU_RIGHT)) { else if (input_pressed(A_MENU_RIGHT) || input_pressed(A_MENU_RIGHT_2) || input_pressed(A_MENU_RIGHT_3)) {
page->index++; page->index++;
} }
} }
else { else {
if (input_pressed(A_MENU_UP)) { if (input_pressed(A_MENU_UP) || input_pressed(A_MENU_UP_2) || input_pressed(A_MENU_UP_3)) {
page->index--; page->index--;
} }
if (input_pressed(A_MENU_DOWN)) { if (input_pressed(A_MENU_DOWN) || input_pressed(A_MENU_DOWN_2) || input_pressed(A_MENU_DOWN_3)) {
page->index++; page->index++;
} }
} }