mirror of
https://github.com/Polprzewodnikowy/N64FlashcartMenu.git
synced 2024-11-21 18:19:19 +01:00
Cleaned up navigation
This commit is contained in:
parent
621e50cf7b
commit
3846547707
@ -20,9 +20,7 @@ static void actions_clear (menu_t *menu) {
|
||||
menu->actions.enter = false;
|
||||
menu->actions.back = false;
|
||||
menu->actions.options = false;
|
||||
menu->actions.system_info = false;
|
||||
menu->actions.settings = false;
|
||||
menu->actions.credits = false;
|
||||
}
|
||||
|
||||
static void actions_update_direction (menu_t *menu) {
|
||||
@ -91,11 +89,7 @@ static void actions_update_buttons (menu_t *menu) {
|
||||
menu->actions.back = true;
|
||||
} else if (pressed.r) {
|
||||
menu->actions.options = true;
|
||||
} else if (pressed.z) {
|
||||
menu->actions.system_info = true;
|
||||
} else if (pressed.start) {
|
||||
menu->actions.credits = true;
|
||||
} else if (pressed.l) {
|
||||
menu->actions.settings = true;
|
||||
}
|
||||
}
|
||||
|
@ -83,9 +83,7 @@ typedef struct {
|
||||
bool enter;
|
||||
bool back;
|
||||
bool options;
|
||||
bool system_info;
|
||||
bool settings;
|
||||
bool credits;
|
||||
} actions;
|
||||
|
||||
struct {
|
||||
|
@ -228,11 +228,36 @@ static component_context_menu_t entry_context_menu = {
|
||||
}
|
||||
};
|
||||
|
||||
static void edit_settings (menu_t *menu) {
|
||||
menu->next_mode = MENU_MODE_SETTINGS_EDITOR;
|
||||
}
|
||||
|
||||
static void show_system_info (menu_t *menu) {
|
||||
menu->next_mode = MENU_MODE_SYSTEM_INFO;
|
||||
}
|
||||
|
||||
static void show_credits (menu_t *menu) {
|
||||
menu->next_mode = MENU_MODE_CREDITS;
|
||||
}
|
||||
|
||||
static component_context_menu_t settings_context_menu = {
|
||||
.list = {
|
||||
{ .text = "Edit settings", .action = edit_settings },
|
||||
{ .text = "Show system info", .action = show_system_info },
|
||||
{ .text = "Show credits", .action = show_credits },
|
||||
COMPONENT_CONTEXT_MENU_LIST_END,
|
||||
}
|
||||
};
|
||||
|
||||
static void process (menu_t *menu) {
|
||||
if (component_context_menu_process(menu, &entry_context_menu)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (component_context_menu_process(menu, &settings_context_menu)) {
|
||||
return;
|
||||
}
|
||||
|
||||
int scroll_speed = menu->actions.go_fast ? 10 : 1;
|
||||
|
||||
if (menu->browser.entries > 1) {
|
||||
@ -284,12 +309,8 @@ static void process (menu_t *menu) {
|
||||
}
|
||||
} else if (menu->actions.options && menu->browser.entry) {
|
||||
component_context_menu_show(&entry_context_menu);
|
||||
} else if (menu->actions.system_info) {
|
||||
menu->next_mode = MENU_MODE_SYSTEM_INFO;
|
||||
} else if (menu->actions.credits) {
|
||||
menu->next_mode = MENU_MODE_CREDITS;
|
||||
} else if (menu->actions.settings) {
|
||||
menu->next_mode = MENU_MODE_SETTINGS_EDITOR;
|
||||
component_context_menu_show(&settings_context_menu);
|
||||
}
|
||||
}
|
||||
|
||||
@ -326,15 +347,15 @@ static void draw (menu_t *menu, surface_t *d) {
|
||||
|
||||
component_actions_bar_text_draw(
|
||||
ALIGN_RIGHT, VALIGN_TOP,
|
||||
"%s\n"
|
||||
"L: Settings",
|
||||
menu->browser.entries == 0 ? "" : "R: Options"
|
||||
"Start: Settings\n"
|
||||
"^%02XR: Options^00",
|
||||
menu->browser.entries == 0 ? STL_UNKNOWN : STL_DEFAULT
|
||||
);
|
||||
|
||||
if (menu->current_time >= 0) {
|
||||
component_actions_bar_text_draw(
|
||||
ALIGN_CENTER, VALIGN_TOP,
|
||||
"Z: System Info | Start: Credits\n"
|
||||
"\n"
|
||||
"%s",
|
||||
ctime(&menu->current_time)
|
||||
);
|
||||
@ -342,6 +363,8 @@ static void draw (menu_t *menu, surface_t *d) {
|
||||
|
||||
component_context_menu_draw(&entry_context_menu);
|
||||
|
||||
component_context_menu_draw(&settings_context_menu);
|
||||
|
||||
rdpq_detach_show();
|
||||
}
|
||||
|
||||
@ -349,6 +372,7 @@ static void draw (menu_t *menu, surface_t *d) {
|
||||
void view_browser_init (menu_t *menu) {
|
||||
if (!menu->browser.valid) {
|
||||
component_context_menu_init(&entry_context_menu);
|
||||
component_context_menu_init(&settings_context_menu);
|
||||
if (load_directory(menu)) {
|
||||
path_free(menu->browser.directory);
|
||||
menu->browser.directory = path_init("sd:/", "");
|
||||
|
@ -161,8 +161,8 @@ static component_context_menu_t set_tv_type_context_menu = { .list = {
|
||||
}};
|
||||
|
||||
static component_context_menu_t options_context_menu = { .list = {
|
||||
{ .text = "Set Save Type", .submenu = &set_save_type_context_menu },
|
||||
{ .text = "Set TV Type", .submenu = &set_tv_type_context_menu },
|
||||
{ .text = "Set save type", .submenu = &set_save_type_context_menu },
|
||||
{ .text = "Set TV type", .submenu = &set_tv_type_context_menu },
|
||||
COMPONENT_CONTEXT_MENU_LIST_END,
|
||||
}};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user