Make lastActiveMousePos static for menus so the mouse cursor doesn't get detected as "moved" everytime we open a new menu. Fixed compile issues for various aspects of gamepad menu opening. Finished interpreting all combinations of setting up buttons and navigation.
This commit is contained in:
@@ -38,6 +38,7 @@ All rights reserved.
|
||||
|
||||
#include "Menu.h"
|
||||
#include "ScrollableWindowComponent.h"
|
||||
#include "SaveFile.h"
|
||||
|
||||
void Menu::InitializeLoadGameWindow(){
|
||||
Menu*loadGameWindow=CreateMenu(LOAD_GAME,CENTERED,vi2d{96,120});
|
||||
@@ -47,11 +48,11 @@ void Menu::InitializeLoadGameWindow(){
|
||||
loadGameWindow->ADD("Go Back Button",MenuComponent)(geom2d::rect<float>{{24,124},{48,12}},"Back",[](MenuFuncData menu){Menu::CloseMenu();return true;})END;
|
||||
|
||||
loadGameWindow->SetupKeyboardNavigation(
|
||||
[](MenuType type){ //On Open
|
||||
[](MenuType type,Data&returnData){ //On Open
|
||||
if(SaveFile::GetSaveFileCount()>0){
|
||||
Menu::menus[type]->SetSelection(Component<ScrollableWindowComponent>(type,"Game Files List")->GetComponents()[0]);
|
||||
returnData=Component<ScrollableWindowComponent>(type,"Game Files List")->GetComponents()[0];
|
||||
}else{
|
||||
Menu::menus[type]->SetSelection("Go Back Button");
|
||||
returnData="Go Back Button";
|
||||
}
|
||||
},
|
||||
{ //Button Key
|
||||
@@ -64,16 +65,17 @@ void Menu::InitializeLoadGameWindow(){
|
||||
}
|
||||
,{ //Button Navigation Rules
|
||||
{"Game Files List",{
|
||||
.up=[](MenuType type){
|
||||
.up=[](MenuType type,Data&returnData){
|
||||
auto&selection=Menu::menus[type]->GetSelection();
|
||||
auto&gameFilesList=Component<ScrollableWindowComponent>(type,"Game Files List")->GetComponents();
|
||||
if(std::find_if(gameFilesList.begin(),gameFilesList.end(),[&](auto&comp){return comp.lock()==selection.lock();})==gameFilesList.begin()){
|
||||
|
||||
auto component=std::find_if(gameFilesList.begin(),gameFilesList.end(),[&](auto&comp){return comp.lock()==selection.lock();});
|
||||
if(component==gameFilesList.begin()){
|
||||
returnData="Go Back Button";
|
||||
}else{
|
||||
returnData=*(--component);
|
||||
}
|
||||
},
|
||||
.down="Back Button",}},
|
||||
{"Go Back Button",{
|
||||
.left="Continue Button",
|
||||
.right="Continue Button",}},
|
||||
.down="Go Back Button",}},
|
||||
{"Go Back Button",{}},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user