|
|
|
@ -203,6 +203,7 @@ void Menu::Update(AiL*game){ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
selection={}; |
|
|
|
|
for(auto&[key,component]:components){ |
|
|
|
|
if(component->selectable){ |
|
|
|
|
if(!component->disabled&&!component->grayedOut){ |
|
|
|
@ -321,33 +322,35 @@ void Menu::SetDefaultButton(std::weak_ptr<MenuComponent>button){ |
|
|
|
|
void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){ |
|
|
|
|
std::weak_ptr<MenuComponent>prevSelection=selection; |
|
|
|
|
|
|
|
|
|
std::string selectionButtonName=selection.lock()->GetName(); |
|
|
|
|
if(navigationGroups.count(selectionButtonName)){ |
|
|
|
|
Navigation nav=navigationGroups[selectionButtonName]; |
|
|
|
|
if(!selection.expired()){ |
|
|
|
|
std::string selectionButtonName=selection.lock()->GetName(); |
|
|
|
|
if(navigationGroups.count(selectionButtonName)){ |
|
|
|
|
Navigation nav=navigationGroups[selectionButtonName]; |
|
|
|
|
|
|
|
|
|
if(game->KEY_UP.Pressed()){ |
|
|
|
|
SetMouseNavigation(false); |
|
|
|
|
if(std::holds_alternative<std::string>(nav.up)&&std::get<std::string>(nav.up).length()>0)selection=components[std::get<std::string>(nav.up)]; |
|
|
|
|
else |
|
|
|
|
if(std::holds_alternative<MenuDataFunc>(nav.up))std::get<MenuDataFunc>(nav.up)(type); |
|
|
|
|
} |
|
|
|
|
if(game->KEY_DOWN.Pressed()){ |
|
|
|
|
SetMouseNavigation(false); |
|
|
|
|
if(std::holds_alternative<std::string>(nav.down)&&std::get<std::string>(nav.down).length()>0)selection=components[std::get<std::string>(nav.down)]; |
|
|
|
|
else |
|
|
|
|
if(std::holds_alternative<MenuDataFunc>(nav.down))std::get<MenuDataFunc>(nav.down)(type); |
|
|
|
|
} |
|
|
|
|
if(game->KEY_LEFT.Pressed()){ |
|
|
|
|
SetMouseNavigation(false); |
|
|
|
|
if(std::holds_alternative<std::string>(nav.left)&&std::get<std::string>(nav.left).length()>0)selection=components[std::get<std::string>(nav.left)]; |
|
|
|
|
else |
|
|
|
|
if(std::holds_alternative<MenuDataFunc>(nav.left))std::get<MenuDataFunc>(nav.left)(type); |
|
|
|
|
} |
|
|
|
|
if(game->KEY_RIGHT.Pressed()){ |
|
|
|
|
SetMouseNavigation(false); |
|
|
|
|
if(std::holds_alternative<std::string>(nav.right)&&std::get<std::string>(nav.right).length()>0)selection=components[std::get<std::string>(nav.right)]; |
|
|
|
|
else |
|
|
|
|
if(std::holds_alternative<MenuDataFunc>(nav.right))std::get<MenuDataFunc>(nav.right)(type); |
|
|
|
|
if(game->KEY_UP.Pressed()){ |
|
|
|
|
SetMouseNavigation(false); |
|
|
|
|
if(std::holds_alternative<std::string>(nav.up)&&std::get<std::string>(nav.up).length()>0)selection=components[std::get<std::string>(nav.up)]; |
|
|
|
|
else |
|
|
|
|
if(std::holds_alternative<MenuDataFunc>(nav.up))std::get<MenuDataFunc>(nav.up)(type); |
|
|
|
|
} |
|
|
|
|
if(game->KEY_DOWN.Pressed()){ |
|
|
|
|
SetMouseNavigation(false); |
|
|
|
|
if(std::holds_alternative<std::string>(nav.down)&&std::get<std::string>(nav.down).length()>0)selection=components[std::get<std::string>(nav.down)]; |
|
|
|
|
else |
|
|
|
|
if(std::holds_alternative<MenuDataFunc>(nav.down))std::get<MenuDataFunc>(nav.down)(type); |
|
|
|
|
} |
|
|
|
|
if(game->KEY_LEFT.Pressed()){ |
|
|
|
|
SetMouseNavigation(false); |
|
|
|
|
if(std::holds_alternative<std::string>(nav.left)&&std::get<std::string>(nav.left).length()>0)selection=components[std::get<std::string>(nav.left)]; |
|
|
|
|
else |
|
|
|
|
if(std::holds_alternative<MenuDataFunc>(nav.left))std::get<MenuDataFunc>(nav.left)(type); |
|
|
|
|
} |
|
|
|
|
if(game->KEY_RIGHT.Pressed()){ |
|
|
|
|
SetMouseNavigation(false); |
|
|
|
|
if(std::holds_alternative<std::string>(nav.right)&&std::get<std::string>(nav.right).length()>0)selection=components[std::get<std::string>(nav.right)]; |
|
|
|
|
else |
|
|
|
|
if(std::holds_alternative<MenuDataFunc>(nav.right))std::get<MenuDataFunc>(nav.right)(type); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|