Added basic controller keybind support.
This commit is contained in:
@@ -353,19 +353,19 @@ void Menu::OpenMenu(MenuType menu,bool cover){
|
||||
|
||||
void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){
|
||||
vi2d prevSelection=selection;
|
||||
if(game->GetKey(RIGHT).bPressed){
|
||||
if(game->RightPressed()){
|
||||
if(selection==vi2d{-1,-1})return;
|
||||
SetMouseNavigation(false);
|
||||
selection.x=(size_t(selection.x)+1)%keyboardButtons[selection.y].size();
|
||||
}
|
||||
if(game->GetKey(LEFT).bPressed){
|
||||
if(game->LeftPressed()){
|
||||
if(selection==vi2d{-1,-1})return;
|
||||
selection.x--;
|
||||
SetMouseNavigation(false);
|
||||
if(selection.x<0)selection.x+=int32_t(keyboardButtons[selection.y].size());
|
||||
}
|
||||
if(game->GetKey(DOWN).bPressed||game->GetKey(UP).bPressed){
|
||||
if(game->GetKey(DOWN).bPressed){
|
||||
if(game->DownPressed()||game->UpPressed()){
|
||||
if(game->DownPressed()){
|
||||
SetMouseNavigation(false);
|
||||
bool found=false;
|
||||
bool selectedItem=false;
|
||||
@@ -405,7 +405,7 @@ void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){
|
||||
}
|
||||
}
|
||||
}
|
||||
if(game->GetKey(UP).bPressed){
|
||||
if(game->UpPressed()){
|
||||
SetMouseNavigation(false);
|
||||
if(selection==vi2d{-1,-1}){
|
||||
//Highlight last item.
|
||||
|
||||
Reference in New Issue
Block a user