Wipwork for updating the BaseUI

Adds ability to select an actionmap for a GuiInputCtrl which will push it onto the stack, so menus can enact an action map
Update of the MainMenuGUI to fit new style and have the logic needed for KBM and gamepad navigation
Very early wipwork of OptionsMenu overhaul for new standard
This commit is contained in:
Areloch 2023-12-06 19:50:51 -06:00
parent 97de2e6b60
commit 616d974212
12 changed files with 746 additions and 492 deletions

View file

@ -64,6 +64,7 @@ GuiInputCtrl::GuiInputCtrl()
mSendModifierEvents(false),
mIgnoreMouseEvents(false)
{
mActionmap = nullptr;
}
//------------------------------------------------------------------------------
@ -80,6 +81,7 @@ void GuiInputCtrl::initPersistFields()
"If true, Make events will be sent for modifier keys (Default false).");
addField("ignoreMouseEvents", TypeBool, Offset(mIgnoreMouseEvents, GuiInputCtrl),
"If true, any events from mouse devices will be passed through.");
addField("actionMap", TYPEID<ActionMap>(), Offset(mActionmap, GuiInputCtrl), "The name of an action map to push/pop on the input stack alongside the wake/sleep of this control.");
endGroup("GuiInputCtrl");
Parent::initPersistFields();
@ -103,6 +105,12 @@ bool GuiInputCtrl::onWake()
if( !smDesignTime && !mIgnoreMouseEvents)
mouseLock();
if(mActionmap != nullptr)
{
SimSet* actionMapSet = Sim::getActiveActionMapSet();
actionMapSet->pushObject(mActionmap);
}
setFirstResponder();
@ -115,6 +123,13 @@ void GuiInputCtrl::onSleep()
{
Parent::onSleep();
mouseUnlock();
if (mActionmap != nullptr)
{
SimSet* actionMapSet = Sim::getActiveActionMapSet();
actionMapSet->removeObject(mActionmap);
}
clearFirstResponder();
}
@ -158,6 +173,9 @@ bool GuiInputCtrl::onInputEvent( const InputEventInfo &event )
if (mIgnoreMouseEvents && event.deviceType == MouseDeviceType)
return false;
if (mActionmap != nullptr)
return false;
char deviceString[32];
if ( event.action == SI_MAKE )
{