From a506c47aea682fbb2d99e18109480dda18835a37 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Sun, 3 Mar 2024 01:58:40 -0600 Subject: [PATCH] Credits navigation key actually pops up the credits for controllers. --- Adventures in Lestoria/AdventuresInLestoria.cpp | 3 --- Adventures in Lestoria/Key.cpp | 3 +++ Adventures in Lestoria/MainMenuWindow.cpp | 4 +++- Adventures in Lestoria/Menu.cpp | 4 ++++ Adventures in Lestoria/Menu.h | 2 ++ 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index db61a997..f5acc998 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -3558,9 +3558,6 @@ void AiL::GetAnyKeyRelease(Key key){ if(InputGroup::menuNamesToInputGroups.count(Menu::menus[NEW_INPUT]->S(A::KEYBIND))){ InputGroup::menuNamesToInputGroups[Menu::menus[NEW_INPUT]->S(A::KEYBIND)]->SetNewPrimaryKeybind(Input{KEY,key}); Menu::alreadyClicked=true; - for(auto[menuType,menu]:Menu::menus){ - menu->helpDisplay.Initialize(menu->inputGroups); - } Menu::CloseMenu(); } }else{ diff --git a/Adventures in Lestoria/Key.cpp b/Adventures in Lestoria/Key.cpp index 6e9b3646..e35f3014 100644 --- a/Adventures in Lestoria/Key.cpp +++ b/Adventures in Lestoria/Key.cpp @@ -792,6 +792,9 @@ void InputGroup::AddPrimaryKeybind(Input key){ void InputGroup::SetNewPrimaryKeybind(Input key){ RemovePrimaryKeybind(key.GetType()); AddPrimaryKeybind(key); + for(auto[menuType,menu]:Menu::menus){ + menu->ReInitializeInputGroup(); + } } void InputListener::Update(){ diff --git a/Adventures in Lestoria/MainMenuWindow.cpp b/Adventures in Lestoria/MainMenuWindow.cpp index c62dbc20..85f122f3 100644 --- a/Adventures in Lestoria/MainMenuWindow.cpp +++ b/Adventures in Lestoria/MainMenuWindow.cpp @@ -83,7 +83,9 @@ void Menu::InitializeMainMenuWindow(){ }, { //Button Key {game->KEY_CONFIRM,{"Select",[](MenuType type){}}}, - {game->KEY_SELECT,{"Credits",[](MenuType type){}}}, + {game->KEY_MENU,{"Credits",[](MenuType type){ + Component(type,"Credits Button")->Click(); + }}}, } ,{ //Button Navigation Rules {"New Game Button",{ diff --git a/Adventures in Lestoria/Menu.cpp b/Adventures in Lestoria/Menu.cpp index 2d173ced..647d0c96 100644 --- a/Adventures in Lestoria/Menu.cpp +++ b/Adventures in Lestoria/Menu.cpp @@ -785,4 +785,8 @@ void Menu::IgnoreNextMouseNavigationAttempt(){ bool Menu::IsCurrentlyActive(MenuType type){ if(Menu::stack.size()==0)return false; return Menu::stack.back()->GetType()==type; +} + +void Menu::ReInitializeInputGroup(){ + helpDisplay.Initialize(inputGroups); } \ No newline at end of file diff --git a/Adventures in Lestoria/Menu.h b/Adventures in Lestoria/Menu.h index 3d47ab5d..8f34375f 100644 --- a/Adventures in Lestoria/Menu.h +++ b/Adventures in Lestoria/Menu.h @@ -189,6 +189,8 @@ public: static std::pairGetMemoryLeakReportInfo(); virtual void Cleanup(); + void ReInitializeInputGroup(); + static void DrawThemedWindow(vf2d menuPos,vf2d size,Pixel renderColor=WHITE); //X (0-2), Y (0-2) for specific 9-patch tile (tiled version).