implement L and R as extra menus instead of extra keys for X (#148)

L is now the sorting menu
R is unused
This commit is contained in:
LiquidFenrir
2018-04-10 01:28:37 +02:00
committed by Alex Taber
parent 6f7c2489d5
commit 7b1d6f9860
2 changed files with 96 additions and 52 deletions

View File

@@ -98,7 +98,30 @@ Instructions_s install_instructions = {
} }
}; };
Instructions_s extra_instructions = { Instructions_s extra_instructions[3] = {
{
.info_line = L"Release \uE002 to cancel or hold \uE006 and release \uE002 to sort",
.info_line_color = COLOR_WHITE,
.instructions = {
{
L"\uE079 Sort by name",
L"\uE07A Sort by author"
},
{
L"\uE07B Sort by filename",
NULL
},
{
NULL,
NULL
},
{
L"Exit",
NULL
}
}
},
{
.info_line = L"Release \uE002 to cancel or hold \uE006 and release \uE002 to do stuff", .info_line = L"Release \uE002 to cancel or hold \uE006 and release \uE002 to do stuff",
.info_line_color = COLOR_WHITE, .info_line_color = COLOR_WHITE,
.instructions = { .instructions = {
@@ -108,17 +131,18 @@ Instructions_s extra_instructions = {
}, },
{ {
L"\uE07B Browse ThemePlaza", L"\uE07B Browse ThemePlaza",
L"\uE07C Sort by filename" NULL,
}, },
{ {
L"\uE004 Sort by name", L"\uE004 Sorting menu",
L"\uE005 Sort by author" NULL
}, },
{ {
L"Exit", L"Exit",
NULL NULL
} }
} }
},
}; };
#endif #endif

View File

@@ -347,7 +347,19 @@ int main(void)
if(install_mode) if(install_mode)
instructions = install_instructions; instructions = install_instructions;
if(extra_mode) if(extra_mode)
instructions = extra_instructions; {
int index = 1;
bool key_l = (kDown | kHeld) & KEY_L;
bool key_r = (kDown | kHeld) & KEY_R;
if(key_l ^ key_r)
{
if(key_l)
index = 0;
// else if(key_r) // uncomment when we use the right menu. we don't for now
// index = 2;
}
instructions = extra_instructions[index];
}
if(qr_mode) take_picture(); if(qr_mode) take_picture();
else if(preview_mode) draw_preview(TEXTURE_PREVIEW, preview_offset); else if(preview_mode) draw_preview(TEXTURE_PREVIEW, preview_offset);
@@ -526,6 +538,10 @@ int main(void)
if(kUp & KEY_X) if(kUp & KEY_X)
extra_mode = false; extra_mode = false;
if(!extra_mode) if(!extra_mode)
{
bool key_l = (kDown | kHeld) & KEY_L;
bool key_r = (kDown | kHeld) & KEY_R;
if(!(key_l ^ key_r))
{ {
if((kDown | kHeld) & KEY_DLEFT) if((kDown | kHeld) & KEY_DLEFT)
{ {
@@ -542,29 +558,33 @@ int main(void)
jump_menu(current_list); jump_menu(current_list);
} }
else if((kDown | kHeld) & KEY_DRIGHT) else if((kDown | kHeld) & KEY_DDOWN)
{
load_icons_first(current_list, false);
}
}
else if(key_l)
{
if((kDown | kHeld) & KEY_DLEFT)
{ {
sort_path: sort_path:
sort_by_filename(current_list); sort_by_filename(current_list);
load_icons_first(current_list, false); load_icons_first(current_list, false);
} }
else if((kDown | kHeld) & KEY_DDOWN) else if(((kDown | kHeld)) & KEY_DUP)
{
load_icons_first(current_list, false);
}
else if(((kDown | kHeld)) & KEY_L)
{ {
sort_name: sort_name:
sort_by_name(current_list); sort_by_name(current_list);
load_icons_first(current_list, false); load_icons_first(current_list, false);
} }
else if(((kDown | kHeld)) & KEY_R) else if(((kDown | kHeld)) & KEY_DDOWN)
{ {
sort_author: sort_author:
sort_by_author(current_list); sort_by_author(current_list);
load_icons_first(current_list, false); load_icons_first(current_list, false);
} }
} }
}
continue; continue;
} }