Skip to content
This repository has been archived by the owner on Jan 7, 2021. It is now read-only.

Commit

Permalink
add ability to navigate faster
Browse files Browse the repository at this point in the history
for people with a lot of entries
  • Loading branch information
LiquidFenrir committed Jan 20, 2017
1 parent cf60018 commit 35abefb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
10 changes: 9 additions & 1 deletion source/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ void drawInstructions()

void drawMenu(config * parsed_config, u8 * state, u8 selected_entry)
{
if (selected_entry >= (MAX_ENTRIES_PER_SCREEN + scroll)) {
if (selected_entry == 0) {
scroll = 0;
}
else if(selected_entry == parsed_config->entries_number-1) {
scroll = parsed_config->entries_number - MAX_ENTRIES_PER_SCREEN;
if (scroll >= parsed_config->entries_number)
scroll = 0;
}
else if (selected_entry >= (MAX_ENTRIES_PER_SCREEN + scroll)) {
scroll++;
}
else if ((selected_entry - scroll) < 0) {
Expand Down
6 changes: 6 additions & 0 deletions source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ int main()
if (selected_entry >= parsed_config.entries_number)
selected_entry = 0;
}
else if (hidKeysDown() & KEY_RIGHT) { //go to bottom of the menu
selected_entry = parsed_config.entries_number-1;
}
else if (hidKeysDown() & KEY_LEFT) { //go to top of the menu
selected_entry = 0;
}
else if (hidKeysDown() & KEY_L) { //mark all entries
for (u8 i = 0; i < parsed_config.entries_number; i++) {
state[i] |= STATE_MARKED;
Expand Down

0 comments on commit 35abefb

Please sign in to comment.