mirror of https://github.com/mgba-emu/mgba.git
GUI: Submenus
This commit is contained in:
parent
d724d914c8
commit
44736f89be
|
@ -56,8 +56,15 @@ enum GUIMenuExitReason GUIShowMenu(struct GUIParams* params, struct GUIMenu* men
|
|||
}
|
||||
if (newInput & (1 << GUI_INPUT_SELECT)) {
|
||||
*item = *GUIMenuItemListGetPointer(&menu->items, menu->index);
|
||||
if (item->submenu) {
|
||||
enum GUIMenuExitReason reason = GUIShowMenu(params, item->submenu, item);
|
||||
if (reason != GUI_MENU_EXIT_BACK) {
|
||||
return reason;
|
||||
}
|
||||
} else {
|
||||
return GUI_MENU_EXIT_ACCEPT;
|
||||
}
|
||||
}
|
||||
if (newInput & (1 << GUI_INPUT_BACK)) {
|
||||
return GUI_MENU_EXIT_BACK;
|
||||
}
|
||||
|
|
|
@ -8,9 +8,11 @@
|
|||
|
||||
#include "util/vector.h"
|
||||
|
||||
struct GUIMenu;
|
||||
struct GUIMenuItem {
|
||||
const char* title;
|
||||
void* data;
|
||||
struct GUIMenu* submenu;
|
||||
};
|
||||
|
||||
DECLARE_VECTOR(GUIMenuItemList, struct GUIMenuItem);
|
||||
|
|
Loading…
Reference in New Issue