diff --git a/apps/openmw/mwgui/birth.cpp b/apps/openmw/mwgui/birth.cpp index b047f6dc5f..5a5605aa6e 100644 --- a/apps/openmw/mwgui/birth.cpp +++ b/apps/openmw/mwgui/birth.cpp @@ -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; } diff --git a/apps/openmw/mwgui/birth.hpp b/apps/openmw/mwgui/birth.hpp index 09a0b7b1b5..b41b1fbb9a 100644 --- a/apps/openmw/mwgui/birth.hpp +++ b/apps/openmw/mwgui/birth.hpp @@ -59,7 +59,6 @@ namespace MWGui ESM::RefId mCurrentBirthId; bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override; - bool mOkButtonFocus = true; }; } #endif diff --git a/apps/openmw/mwgui/class.cpp b/apps/openmw/mwgui/class.cpp index 700c431246..f0fe5537da 100644 --- a/apps/openmw/mwgui/class.cpp +++ b/apps/openmw/mwgui/class.cpp @@ -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() {} diff --git a/apps/openmw/mwgui/class.hpp b/apps/openmw/mwgui/class.hpp index 9f04fa9e13..a4db03d4ab 100644 --- a/apps/openmw/mwgui/class.hpp +++ b/apps/openmw/mwgui/class.hpp @@ -155,7 +155,6 @@ namespace MWGui ESM::RefId mCurrentClassId; bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override; - bool mOkButtonFocus = true; }; class SelectSpecializationDialog : public WindowModal diff --git a/apps/openmw/mwgui/levelupdialog.cpp b/apps/openmw/mwgui/levelupdialog.cpp index 3b14415206..3ed3e3b6fc 100644 --- a/apps/openmw/mwgui/levelupdialog.cpp +++ b/apps/openmw/mwgui/levelupdialog.cpp @@ -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(); diff --git a/apps/openmw/mwgui/race.cpp b/apps/openmw/mwgui/race.cpp index 172812bf47..fdc8725fa0 100644 --- a/apps/openmw/mwgui/race.cpp +++ b/apps/openmw/mwgui/race.cpp @@ -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; } diff --git a/apps/openmw/mwgui/race.hpp b/apps/openmw/mwgui/race.hpp index 3652343308..ead058214c 100644 --- a/apps/openmw/mwgui/race.hpp +++ b/apps/openmw/mwgui/race.hpp @@ -124,7 +124,6 @@ namespace MWGui bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override; bool onControllerThumbstickEvent(const SDL_ControllerAxisEvent& arg) override; - bool mOkButtonFocus = true; }; } #endif diff --git a/apps/openmw/mwgui/review.cpp b/apps/openmw/mwgui/review.cpp index dda00bd33a..003cdb49cb 100644 --- a/apps/openmw/mwgui/review.cpp +++ b/apps/openmw/mwgui/review.cpp @@ -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", {}))); } }