Skip to content

Commit

Permalink
simplifying logic
Browse files Browse the repository at this point in the history
  • Loading branch information
bittboy committed Sep 22, 2019
1 parent cb651a4 commit 2a6b4f4
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions simplemenu/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,36 +53,30 @@ void scrollUp() {
if(CURRENT_SECTION.currentGame == 0) {
if (CURRENT_SECTION.currentPage >0) {
CURRENT_SECTION.currentPage--;
gamesInPage=countGamesInPage();
CURRENT_SECTION.currentGame=gamesInPage-1;
return;
} else {
CURRENT_SECTION.currentPage=totalPages;
gamesInPage=countGamesInPage();
CURRENT_SECTION.currentGame=gamesInPage;
}
gamesInPage=countGamesInPage();
CURRENT_SECTION.currentGame=gamesInPage-1;
return;
}
if (CURRENT_SECTION.currentGame > 0) {
CURRENT_SECTION.currentGame--;
return;
}
}

void scrollDown() {
if(CURRENT_SECTION.currentGame == gamesInPage-1) {
if (CURRENT_SECTION.currentPage < totalPages) {
CURRENT_SECTION.currentGame=0;
CURRENT_SECTION.currentPage++;
return;
} else {
CURRENT_SECTION.currentGame=0;
CURRENT_SECTION.currentPage=0;
return;
}
CURRENT_SECTION.currentGame=0;
return;
}
if (CURRENT_SECTION.currentGame < gamesInPage-1) {
CURRENT_SECTION.currentGame++;
return;
}
}

Expand Down

0 comments on commit 2a6b4f4

Please sign in to comment.