When switching from mouse to keyboard navigation, the first input is ignored such that it will reveal where the cursor currently is at. Updated to Release Build 6020.

This commit is contained in:
sigonasr2 2024-01-18 23:24:24 -06:00
parent f8a9bd1e27
commit aec9646d40
5 changed files with 13 additions and 18 deletions

View File

@ -59,18 +59,6 @@ safemap<ITCategory,std::vector<std::weak_ptr<MenuComponent>>>Menu::merchantInven
std::vector<std::weak_ptr<MenuComponent>>Menu::equipStatListeners; std::vector<std::weak_ptr<MenuComponent>>Menu::equipStatListeners;
std::vector<std::weak_ptr<MenuComponent>>Menu::chapterListeners; std::vector<std::weak_ptr<MenuComponent>>Menu::chapterListeners;
const vf2d Menu::CENTERED = {-456,-456}; const vf2d Menu::CENTERED = {-456,-456};
//////////////////////////////////////////////////////////////////////////////////////////////////
///__/////////////////////////////////////////////////////////////////////////////////////////////
//| |////////////////////////////////////////////////////////////////////////////////////////////
//| |/////WARNING! If you are adding something here you likely are adding another container with MenuComponent pointers in it right now.
//| |/////Because we are handling raw pointers, you must also add this container to the list of iterating search removal containers that occur in the
//| |/////DESTRUCTOR of MenuComponents!!!!! (Go to MenuComponent::~MenuComponent()) THIS IS NOT A DRILL!
//|__|////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
///__/////////////////////////////////////////////////////////////////////////////////////////////
//|__/////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
MenuType Menu::lastMenuTypeCreated; MenuType Menu::lastMenuTypeCreated;
std::string Menu::lastRegisteredComponent; std::string Menu::lastRegisteredComponent;
@ -129,8 +117,12 @@ Menu*Menu::CreateMenu(MenuType type,vf2d pos,vf2d size){
void Menu::CheckClickAndPerformMenuSelect(AiL*game){ void Menu::CheckClickAndPerformMenuSelect(AiL*game){
if(game->KEY_CONFIRM.Released()){ if(game->KEY_CONFIRM.Released()){
if(ignoreInputs){
ignoreInputs=false;
}else{
MenuSelect(game); MenuSelect(game);
} }
}
} }
void Menu::HoverMenuSelect(AiL*game){ void Menu::HoverMenuSelect(AiL*game){
@ -481,6 +473,7 @@ void Menu::SetMouseNavigation(bool mouseNavigation){
if(MOUSE_NAVIGATION&&!mouseNavigation){ if(MOUSE_NAVIGATION&&!mouseNavigation){
//When mouse navigation was enabled and now needs to be disabled, we store the mouse position. //When mouse navigation was enabled and now needs to be disabled, we store the mouse position.
lastActiveMousePos=game->GetMousePos(); lastActiveMousePos=game->GetMousePos();
ignoreInputs=true;
if(!keyboardSelection.expired()){ if(!keyboardSelection.expired()){
SetSelection(keyboardSelection); SetSelection(keyboardSelection);
} }

View File

@ -250,6 +250,8 @@ private:
std::weak_ptr<MenuComponent>selection; std::weak_ptr<MenuComponent>selection;
std::weak_ptr<MenuComponent>keyboardSelection; std::weak_ptr<MenuComponent>keyboardSelection;
bool ignoreInputs=false; //We set this to true because on the next button release, we don't want buttons to cause menu navigation. This is for when the player needs to activate the cursor via keyboard/gamepad and nothing is highlighted. It gets reset to false once a button has been released.
static bool MOUSE_NAVIGATION; static bool MOUSE_NAVIGATION;
bool cover; //A black cover for when a menu pops up to fade out the stuff behind it. bool cover; //A black cover for when a menu pops up to fade out the stuff behind it.
}; };

View File

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_PATCH 1 #define VERSION_PATCH 1
#define VERSION_BUILD 6014 #define VERSION_BUILD 6020
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

View File

@ -1076,7 +1076,7 @@
</object> </object>
<object id="4" name="Green Slime" type="Monster" x="1052" y="4304"> <object id="4" name="Green Slime" type="Monster" x="1052" y="4304">
<properties> <properties>
<property name="Type" propertytype="MonsterName" value="Bear"/> <property name="Type" propertytype="MonsterName" value="Green Slime"/>
<property name="spawner" type="object" value="2"/> <property name="spawner" type="object" value="2"/>
</properties> </properties>
<point/> <point/>
@ -1717,14 +1717,14 @@
</object> </object>
<object id="151" name="Green Slime" type="Monster" x="1056" y="4386"> <object id="151" name="Green Slime" type="Monster" x="1056" y="4386">
<properties> <properties>
<property name="Type" propertytype="MonsterName" value="Bear"/> <property name="Type" propertytype="MonsterName" value="Green Slime"/>
<property name="spawner" type="object" value="2"/> <property name="spawner" type="object" value="2"/>
</properties> </properties>
<point/> <point/>
</object> </object>
<object id="155" name="Green Slime" type="Monster" x="1050" y="4218"> <object id="155" name="Green Slime" type="Monster" x="1050" y="4218">
<properties> <properties>
<property name="Type" propertytype="MonsterName" value="Bear"/> <property name="Type" propertytype="MonsterName" value="Green Slime"/>
<property name="spawner" type="object" value="2"/> <property name="spawner" type="object" value="2"/>
</properties> </properties>
<point/> <point/>