From ef50578a625544e7f9d942cef20ef5e155b43c5f Mon Sep 17 00:00:00 2001 From: Andrew Lanzone Date: Sat, 19 Jul 2025 18:09:00 -0700 Subject: [PATCH] Move controller button overlay padding into layout file --- .../openmw/mwgui/controllerbuttonsoverlay.cpp | 25 +- .../openmw/mwgui/controllerbuttonsoverlay.hpp | 3 +- .../mygui/openmw_controllerbuttons.layout | 377 ++++++++++-------- 3 files changed, 221 insertions(+), 184 deletions(-) diff --git a/apps/openmw/mwgui/controllerbuttonsoverlay.cpp b/apps/openmw/mwgui/controllerbuttonsoverlay.cpp index dc3534e1b9..ac4f95ff7c 100644 --- a/apps/openmw/mwgui/controllerbuttonsoverlay.cpp +++ b/apps/openmw/mwgui/controllerbuttonsoverlay.cpp @@ -31,8 +31,9 @@ namespace MWGui for (size_t i = 0; i < mButtons.size(); i++) { - getWidget(mButtons[i].mImage, "Btn" + mButtons[i].mName + "Image"); - getWidget(mButtons[i].mText, "Btn" + mButtons[i].mName + "Text"); + getWidget(mButtons[i].mImage, "Btn" + mButtons[i].mLayoutName + "Image"); + getWidget(mButtons[i].mText, "Btn" + mButtons[i].mLayoutName + "Text"); + getWidget(mButtons[i].mHBox, "Btn" + mButtons[i].mLayoutName); setIcon(mButtons[i].mImage, mButtons[i].mImagePath); } @@ -77,27 +78,17 @@ namespace MWGui int ControllerButtonsOverlay::updateButton(ControllerButtonsOverlay::Button button, const std::string& buttonStr) { - MyGUI::TextBox* text = mButtons[button].mText; - MyGUI::ImageBox* image = mButtons[button].mImage; - if (buttonStr.empty()) { - image->setVisible(false); - image->setUserString("Hidden", "true"); - - text->setVisible(false); - text->setUserString("Hidden", "true"); + mButtons[button].mHBox->setVisible(false); + mButtons[button].mHBox->setUserString("Hidden", "true"); return 0; } else { - image->setVisible(true); - image->setUserString("Hidden", "false"); - - text->setCaptionWithReplacing(buttonStr); - text->setVisible(true); - text->setUserString("Hidden", "false"); - text->setSize(text->getTextSize().width + 16, 48); + mButtons[button].mHBox->setVisible(true); + mButtons[button].mHBox->setUserString("Hidden", "false"); + mButtons[button].mText->setCaptionWithReplacing(buttonStr); return 1; } } diff --git a/apps/openmw/mwgui/controllerbuttonsoverlay.hpp b/apps/openmw/mwgui/controllerbuttonsoverlay.hpp index 44f93580a3..623424caf2 100644 --- a/apps/openmw/mwgui/controllerbuttonsoverlay.hpp +++ b/apps/openmw/mwgui/controllerbuttonsoverlay.hpp @@ -41,10 +41,11 @@ namespace MWGui struct ButtonDetails { - std::string mName; + std::string mLayoutName; std::string mImagePath; MyGUI::ImageBox* mImage = nullptr; MyGUI::TextBox* mText = nullptr; + Gui::HBox* mHBox = nullptr; }; std::array mButtons; diff --git a/files/data/mygui/openmw_controllerbuttons.layout b/files/data/mygui/openmw_controllerbuttons.layout index e0e68bf2ed..30f92b9b4b 100644 --- a/files/data/mygui/openmw_controllerbuttons.layout +++ b/files/data/mygui/openmw_controllerbuttons.layout @@ -6,203 +6,248 @@ - + - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + +