1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-10-17 21:16:38 +00:00

Update controller buttons for character creation and level up

This commit is contained in:
Andrew Lanzone 2025-06-01 16:27:49 -07:00
parent 263863f3f2
commit 2aa9847b24
8 changed files with 49 additions and 55 deletions

View file

@ -60,10 +60,9 @@ namespace MWGui
if (Settings::gui().mControllerMenus)
{
mOkButton->setStateSelected(true);
mControllerButtons.lStick = "#{sMouse}";
mControllerButtons.a = "#{sSelect}";
mControllerButtons.b = "#{sBack}";
mControllerButtons.x = "#{sDone}";
}
updateBirths();
@ -76,8 +75,17 @@ namespace MWGui
getWidget(okButton, "OKButton");
if (shown)
{
okButton->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sNext", {})));
mControllerButtons.x = "#{sNext}";
}
else if (Settings::gui().mControllerMenus)
{
okButton->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sDone", {})));
mControllerButtons.x = "#{sDone}";
}
else
okButton->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {})));
@ -280,14 +288,7 @@ namespace MWGui
bool BirthDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
{
if (arg.button == SDL_CONTROLLER_BUTTON_A)
{
if (mOkButtonFocus)
onOkClicked(mOkButton);
else
onBackClicked(mBackButton);
}
else if (arg.button == SDL_CONTROLLER_BUTTON_B)
if (arg.button == SDL_CONTROLLER_BUTTON_B)
{
onBackClicked(mBackButton);
}
@ -307,13 +308,6 @@ namespace MWGui
winMgr->setKeyFocusWidget(mBirthList);
winMgr->injectKeyPress(MyGUI::KeyCode::ArrowDown, 0, false);
}
else if ((arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT && mOkButtonFocus) ||
(arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT && !mOkButtonFocus))
{
mOkButtonFocus = !mOkButtonFocus;
mOkButton->setStateSelected(mOkButtonFocus);
mBackButton->setStateSelected(!mOkButtonFocus);
}
return true;
}

View file

@ -59,7 +59,6 @@ namespace MWGui
ESM::RefId mCurrentBirthId;
bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
bool mOkButtonFocus = true;
};
}
#endif

View file

@ -149,10 +149,9 @@ namespace MWGui
if (Settings::gui().mControllerMenus)
{
mOkButton->setStateSelected(true);
mControllerButtons.lStick = "#{sMouse}";
mControllerButtons.a = "#{sSelect}";
mControllerButtons.b = "#{sBack}";
mControllerButtons.x = "#{sDone}";
}
updateClasses();
@ -165,8 +164,17 @@ namespace MWGui
getWidget(okButton, "OKButton");
if (shown)
{
okButton->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sNext", {})));
mControllerButtons.x = "#{sNext}";
}
else if (Settings::gui().mControllerMenus)
{
okButton->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sDone", {})));
mControllerButtons.x = "#{sDone}";
}
else
okButton->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {})));
@ -317,14 +325,7 @@ namespace MWGui
bool PickClassDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
{
if (arg.button == SDL_CONTROLLER_BUTTON_A)
{
if (mOkButtonFocus)
onOkClicked(mOkButton);
else
onBackClicked(mBackButton);
}
else if (arg.button == SDL_CONTROLLER_BUTTON_B)
if (arg.button == SDL_CONTROLLER_BUTTON_B)
{
onBackClicked(mBackButton);
}
@ -344,13 +345,6 @@ namespace MWGui
winMgr->setKeyFocusWidget(mClassList);
winMgr->injectKeyPress(MyGUI::KeyCode::ArrowDown, 0, false);
}
else if ((arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT && mOkButtonFocus) ||
(arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT && !mOkButtonFocus))
{
mOkButtonFocus = !mOkButtonFocus;
mOkButton->setStateSelected(mOkButtonFocus);
mBackButton->setStateSelected(!mOkButtonFocus);
}
return true;
}
@ -590,9 +584,9 @@ namespace MWGui
if (Settings::gui().mControllerMenus)
{
okButton->setStateSelected(true);
mControllerButtons.lStick = "#{sMouse}";
mControllerButtons.a = "#{sSelect}";
mControllerButtons.b = "#{sBack}";
mControllerButtons.x = "#{sDone}";
}
// Set default skills, attributes
@ -681,8 +675,17 @@ namespace MWGui
getWidget(okButton, "OKButton");
if (shown)
{
okButton->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sNext", {})));
mControllerButtons.x = "#{sNext}";
}
else if (Settings::gui().mControllerMenus)
{
okButton->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sDone", {})));
mControllerButtons.x = "#{sDone}";
}
else
okButton->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {})));
@ -1150,6 +1153,8 @@ namespace MWGui
// Make sure the edit box has focus
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mTextEdit);
mControllerButtons.a = "#{sOk}";
}
DescriptionDialog::~DescriptionDialog() {}

View file

@ -155,7 +155,6 @@ namespace MWGui
ESM::RefId mCurrentClassId;
bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
bool mOkButtonFocus = true;
};
class SelectSpecializationDialog : public WindowModal

View file

@ -97,6 +97,8 @@ namespace MWGui
mDisableGamepadCursor = true;
mControllerButtons.a = "#{sSelect}";
mControllerButtons.x = "#{sDone}";
mOkButton->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sDone", {})));
}
center();

View file

@ -108,10 +108,9 @@ namespace MWGui
if (Settings::gui().mControllerMenus)
{
mOkButton->setStateSelected(true);
mControllerButtons.lStick = "#{sMouse}";
mControllerButtons.a = "#{sSelect}";
mControllerButtons.b = "#{sBack}";
mControllerButtons.x = "#{sDone}";
mControllerButtons.y = "#{sSex}";
mControllerButtons.l1 = "#{sHair}";
mControllerButtons.r1 = "#{sFace}";
@ -128,8 +127,17 @@ namespace MWGui
getWidget(okButton, "OKButton");
if (shown)
{
okButton->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sNext", {})));
mControllerButtons.x = "#{sNext}";
}
else if (Settings::gui().mControllerMenus)
{
okButton->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sDone", {})));
mControllerButtons.x = "#{sDone}";
}
else
okButton->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {})));
@ -463,14 +471,7 @@ namespace MWGui
bool RaceDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
{
if (arg.button == SDL_CONTROLLER_BUTTON_A)
{
if (mOkButtonFocus)
onOkClicked(mOkButton);
else
onBackClicked(mBackButton);
}
else if (arg.button == SDL_CONTROLLER_BUTTON_B)
if (arg.button == SDL_CONTROLLER_BUTTON_B)
{
onBackClicked(mBackButton);
}
@ -502,13 +503,6 @@ namespace MWGui
winMgr->setKeyFocusWidget(mRaceList);
winMgr->injectKeyPress(MyGUI::KeyCode::ArrowDown, 0, false);
}
else if ((arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT && mOkButtonFocus) ||
(arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT && !mOkButtonFocus))
{
mOkButtonFocus = !mOkButtonFocus;
mOkButton->setStateSelected(mOkButtonFocus);
mBackButton->setStateSelected(!mOkButtonFocus);
}
return true;
}

View file

@ -124,7 +124,6 @@ namespace MWGui
bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
bool onControllerThumbstickEvent(const SDL_ControllerAxisEvent& arg) override;
bool mOkButtonFocus = true;
};
}
#endif

View file

@ -125,6 +125,8 @@ namespace MWGui
mControllerButtons.a = "#{sSelect}";
mControllerButtons.b = "#{sBack}";
mControllerButtons.x = "#{sDone}";
okButton->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sDone", {})));
}
}