Add in input helper text when navigating using keyboard/gamepads. Fix scrollwheel navigation for ScrollingWindowComponent referencing the wrong variable to add to (after the targeted scroll destination change).
This commit is contained in:
@@ -281,6 +281,10 @@ void Menu::Draw(AiL*game){
|
||||
draggingComponent->DrawDecal(window,this==Menu::stack.back());
|
||||
}
|
||||
}
|
||||
|
||||
if(Menu::stack.back()==this){
|
||||
helpDisplay.Draw();
|
||||
}
|
||||
};
|
||||
|
||||
void Menu::OpenMenu(MenuType menu,bool cover){
|
||||
@@ -297,7 +301,24 @@ void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){
|
||||
std::weak_ptr<MenuComponent>prevSelection=selection;
|
||||
|
||||
for(auto&[input,data]:inputGroups){
|
||||
if(input.Released()||input.Analog()!=0.f){
|
||||
bool activated=false;
|
||||
switch(input.GetEngageType()){
|
||||
case Released:{
|
||||
activated=input.GetGroup().Released();
|
||||
}break;
|
||||
case Pressed:{
|
||||
activated=input.GetGroup().Pressed();
|
||||
}break;
|
||||
case Held:{
|
||||
activated=input.GetGroup().Held();
|
||||
}break;
|
||||
case Analog:{
|
||||
activated=input.GetGroup().Analog()!=0.f;
|
||||
}break;
|
||||
[[unlikely]]default:ERR(std::format("WARNING! Unhandled input engage type {}! THIS SHOULD NOT BE HAPPENING!",int(input.GetEngageType())));
|
||||
}
|
||||
|
||||
if(activated){
|
||||
SetMouseNavigation(false);
|
||||
auto&action=data.second;
|
||||
if(std::holds_alternative<ButtonName>(action))Component<MenuComponent>(type,std::get<ButtonName>(action))->Click();
|
||||
@@ -624,6 +645,7 @@ MenuFuncData::MenuFuncData(Menu&menu,AiL*const game,std::weak_ptr<MenuComponent>
|
||||
void Menu::SetupKeyboardNavigation(MenuDataFunc onOpen,MenuInputGroups inputGroups,ButtonNavigationGroups navigationGroups){
|
||||
this->onOpenFunc=onOpen;
|
||||
this->inputGroups=inputGroups;
|
||||
helpDisplay.Initialize(inputGroups);
|
||||
this->navigationGroups=navigationGroups;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user