When a column matches up in a previous row, we should jump up to that menu item instead.

pull/28/head
sigonasr2 1 year ago
parent 60e46a83f2
commit 2914aa1972
  1. 18
      Crawler/Menu.cpp
  2. 2
      Crawler/Version.h

@ -141,7 +141,16 @@ void Menu::KeyboardButtonNavigation(Crawler*game){
}else{
for(auto&key:buttons){
if(found){ //Once we discover the previous element, the next element becomes our next selection.
int previousButtonX=buttons[selection.y][selection.x].rect.pos.x;
selection.y=key.first;
int index=0;
for(auto&button:key.second){ //Try to match a button in the same column as this button first.
if(previousButtonX==button.rect.pos.x){
selection.x=index;
break;
}
index++;
}
selectedItem=true;
break;
}
@ -174,7 +183,16 @@ void Menu::KeyboardButtonNavigation(Crawler*game){
prevInd=key.first;
}
if(prevInd!=-1){
int previousButtonX=buttons[selection.y][selection.x].rect.pos.x;
selection.y=prevInd;
int index=0;
for(auto&button:buttons[prevInd]){ //Try to match a button in the same column as this button first.
if(previousButtonX==button.rect.pos.x){
selection.x=index;
break;
}
index++;
}
}else{ //Since we didn't find it, it means we're at the top of the list or the list is empty. Go to the last element and use that one.
int lastInd=-1;
for(auto&key:buttons){

@ -2,7 +2,7 @@
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 0
#define VERSION_BUILD 1643
#define VERSION_BUILD 1644
#define stringify(a) stringify_(a)
#define stringify_(a) #a

Loading…
Cancel
Save