From d1dd0219d0c93164b1962a2e1987918e1c3d0fc2 Mon Sep 17 00:00:00 2001 From: MysterD Date: Thu, 15 Jul 2021 18:11:37 -0700 Subject: [PATCH] DJUI: pressing B or escape will go back one menu --- src/pc/djui/djui_interactable.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/pc/djui/djui_interactable.c b/src/pc/djui/djui_interactable.c index 02774fc9..cfcb6b2c 100644 --- a/src/pc/djui/djui_interactable.c +++ b/src/pc/djui/djui_interactable.c @@ -184,6 +184,11 @@ bool djui_interactable_on_key_down(int scancode) { return consume; } + if (scancode == SCANCODE_ESCAPE) { + // pressed escape button on keyboard + djui_panel_back(); + } + switch (scancode) { case SCANCODE_UP: sKeyboardHoldDirection = PAD_HOLD_DIR_UP; return true; case SCANCODE_DOWN: sKeyboardHoldDirection = PAD_HOLD_DIR_DOWN; return true; @@ -301,6 +306,9 @@ void djui_interactable_update(void) { } else { djui_interactable_on_focus(sInteractableFocus); } + } else if ((padButtons & PAD_BUTTON_B) && !(sLastInteractablePad.button & PAD_BUTTON_B)) { + // pressed back button on controller + djui_panel_back(); } if (sInteractableBinding != NULL) {