Auto targeting a component when navigating/selecting in a ScrollableWindowComponent using gamepad/keyboard controls. Added analog stick navigation to load file menu.
This commit is contained in:
@@ -60,8 +60,13 @@ void Menu::InitializeLoadGameWindow(){
|
||||
Component<MenuComponent>(type,"Go Back Button")->Click();
|
||||
}}},
|
||||
{game->KEY_SCROLL,{"Scroll Up/Down",[](MenuType type){
|
||||
auto&scrollWindow=Component<ScrollableWindowComponent>(type,"Game Files List");
|
||||
scrollWindow->SetScrollAmount(scrollWindow->GetScrollAmount()+game->KEY_SCROLL.Analog()*game->GetElapsedTime()*"Interface.AnalogScrollSpeed"_F);
|
||||
auto scrollWindow=Component<ScrollableWindowComponent>(type,"Game Files List");
|
||||
scrollWindow->SetScrollAmount(scrollWindow->GetScrollAmount()-vf2d{0,game->KEY_SCROLL.Analog()*game->GetElapsedTime()*"Interface.AnalogScrollSpeed"_F});
|
||||
for(auto component:scrollWindow->GetComponents()){
|
||||
if(geom2d::overlaps(scrollWindow->GetPos()+scrollWindow->GetSize()/2,geom2d::rect<float>{component.lock()->GetPos(),component.lock()->GetSize()})){
|
||||
Menu::menus[type]->SetSelection(component);
|
||||
}
|
||||
}
|
||||
}}},
|
||||
}
|
||||
,{ //Button Navigation Rules
|
||||
|
||||
Reference in New Issue
Block a user