From bc024da16cfd3f2fa28fb4c8408a130ab853d909 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 10 Nov 2025 16:02:21 +0100 Subject: [PATCH] More tweaks --- Common/Render/Text/draw_text_android.cpp | 2 +- Common/UI/PopupScreens.cpp | 4 ++-- Common/UI/PopupScreens.h | 7 +++---- Common/UI/View.h | 3 +++ UI/IAPScreen.cpp | 4 ++-- UI/MainScreen.cpp | 20 ++++++++++---------- 6 files changed, 21 insertions(+), 19 deletions(-) diff --git a/Common/Render/Text/draw_text_android.cpp b/Common/Render/Text/draw_text_android.cpp index c82bbc16da..3e43e8b691 100644 --- a/Common/Render/Text/draw_text_android.cpp +++ b/Common/Render/Text/draw_text_android.cpp @@ -70,7 +70,7 @@ void TextDrawerAndroid::SetOrCreateFont(const FontStyle &style) { AndroidFontEntry entry{}; entry.font = allocatedFonts_[filename]; - entry.size = 1.4f * style.sizePts / dpiScale_; // Not sure why this formula works. + entry.size = 1.25f * style.sizePts / dpiScale_; // Not sure why this formula works. // Just chose a factor that looks good, don't know what unit size is in anyway. fontMap_[style] = entry; diff --git a/Common/UI/PopupScreens.cpp b/Common/UI/PopupScreens.cpp index 5009a5c739..6de6b6482d 100644 --- a/Common/UI/PopupScreens.cpp +++ b/Common/UI/PopupScreens.cpp @@ -184,9 +184,9 @@ void PopupScreen::CreateViews() { } } else { if (!button2_.empty()) { - buttonRow->Add(new Choice(button2_, new LinearLayoutParams(1.0f)))->OnClick.Handle(this, &UIScreen::OnCancel); + buttonRow->Add(new Choice(button2_, new LinearLayoutParams(1.0f, buttonMargins)))->OnClick.Handle(this, &UIScreen::OnCancel); } - defaultButton_ = buttonRow->Add(new Choice(button1_, button1Image_, new LinearLayoutParams(1.0f))); + defaultButton_ = buttonRow->Add(new Choice(button1_, button1Image_, new LinearLayoutParams(1.0f, buttonMargins))); defaultButton_->OnClick.Handle(this, &UIScreen::OnOK); } diff --git a/Common/UI/PopupScreens.h b/Common/UI/PopupScreens.h index d62135b6b0..6042dea487 100644 --- a/Common/UI/PopupScreens.h +++ b/Common/UI/PopupScreens.h @@ -497,13 +497,12 @@ class ChoiceWithValueDisplay : public AbstractChoiceWithValueDisplay { public: ChoiceWithValueDisplay(int *value, std::string_view text, LayoutParams *layoutParams = 0) : AbstractChoiceWithValueDisplay(text, layoutParams), iValue_(value) {} - + ChoiceWithValueDisplay(int *value, ImageID imageId, LayoutParams *layoutParams = 0) + : AbstractChoiceWithValueDisplay("", imageId, layoutParams), iValue_(value) {} ChoiceWithValueDisplay(std::string *value, std::string_view text, I18NCat category, LayoutParams *layoutParams = 0) : AbstractChoiceWithValueDisplay(text, layoutParams), sValue_(value), category_(category) {} - ChoiceWithValueDisplay(std::string *value, std::string_view text, std::string(*translateCallback)(std::string_view value), LayoutParams *layoutParams = 0) - : AbstractChoiceWithValueDisplay(text, layoutParams), sValue_(value), translateCallback_(translateCallback) { - } + : AbstractChoiceWithValueDisplay(text, layoutParams), sValue_(value), translateCallback_(translateCallback) {} private: std::string ValueText() const override; diff --git a/Common/UI/View.h b/Common/UI/View.h index d196a347d7..80ba75612d 100644 --- a/Common/UI/View.h +++ b/Common/UI/View.h @@ -819,6 +819,9 @@ public: AbstractChoiceWithValueDisplay(std::string_view text, LayoutParams *layoutParams = nullptr) : Choice(text, layoutParams) { } + AbstractChoiceWithValueDisplay(std::string_view text, ImageID image, LayoutParams *layoutParams = nullptr) + : Choice(text, image, layoutParams) { + } void Draw(UIContext &dc) override; void GetContentDimensionsBySpec(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert, float &w, float &h) const override; diff --git a/UI/IAPScreen.cpp b/UI/IAPScreen.cpp index 46f62f40b0..e34e2bf856 100644 --- a/UI/IAPScreen.cpp +++ b/UI/IAPScreen.cpp @@ -15,9 +15,9 @@ void IAPScreen::CreateViews() { auto di = GetI18NCategory(I18NCat::DIALOG); auto mm = GetI18NCategory(I18NCat::MAINMENU); - const bool vertical = GetDeviceOrientation() == DeviceOrientation::Portrait; + const bool portrait = GetDeviceOrientation() == DeviceOrientation::Portrait; - root_ = new LinearLayout(vertical ? ORIENT_VERTICAL : ORIENT_HORIZONTAL, new LayoutParams(FILL_PARENT, FILL_PARENT)); + root_ = new LinearLayout(portrait ? ORIENT_VERTICAL : ORIENT_HORIZONTAL, new LayoutParams(FILL_PARENT, FILL_PARENT)); const bool bought = System_GetPropertyBool(SYSPROP_APP_GOLD); diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index be1b068cf7..91b5eb7a13 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -1170,24 +1170,24 @@ UI::ViewGroup *MainScreen::CreateLogoView(bool portrait, UI::LayoutParams *layou return logos; } -void MainScreen::CreateMainButtons(UI::ViewGroup *parent, bool vertical) { +void MainScreen::CreateMainButtons(UI::ViewGroup *parent, bool portrait) { using namespace UI; auto mm = GetI18NCategory(I18NCat::MAINMENU); - if (vertical) { + if (portrait) { parent->Add(new Spacer(1.0f, new LinearLayoutParams(1.0f))); } if (System_GetPropertyBool(SYSPROP_HAS_FILE_BROWSER)) { - parent->Add(vertical ? new Choice(ImageID("I_FOLDER_OPEN"), vertical ? new LinearLayoutParams() : nullptr) : new Choice(mm->T("Load", "Load...")))->OnClick.Handle(this, &MainScreen::OnLoadFile); + parent->Add(portrait ? new Choice(ImageID("I_FOLDER_OPEN"), portrait ? new LinearLayoutParams() : nullptr) : new Choice(mm->T("Load", "Load...")))->OnClick.Handle(this, &MainScreen::OnLoadFile); } - parent->Add(vertical ? new Choice(ImageID("I_GEAR"), vertical ? new LinearLayoutParams() : nullptr) : new Choice(mm->T("Game Settings", "Settings")))->OnClick.Handle(this, &MainScreen::OnGameSettings); - parent->Add(vertical ? new Choice(ImageID("I_INFO"), vertical ? new LinearLayoutParams() : nullptr) : new Choice(mm->T("About PPSSPP")))->OnClick.Handle(this, &MainScreen::OnCredits); + parent->Add(portrait ? new Choice(ImageID("I_GEAR"), portrait ? new LinearLayoutParams() : nullptr) : new Choice(mm->T("Game Settings", "Settings")))->OnClick.Handle(this, &MainScreen::OnGameSettings); + parent->Add(portrait ? new Choice(ImageID("I_INFO"), portrait ? new LinearLayoutParams() : nullptr) : new Choice(mm->T("About PPSSPP")))->OnClick.Handle(this, &MainScreen::OnCredits); - if (!vertical) { + if (!portrait) { parent->Add(new Choice(mm->T("www.ppsspp.org")))->OnClick.Handle(this, &MainScreen::OnPPSSPPOrg); } if (!System_GetPropertyBool(SYSPROP_APP_GOLD) && (System_GetPropertyInt(SYSPROP_DEVICE_TYPE) != DEVICE_TYPE_VR)) { - Choice *gold = parent->Add(vertical ? new Choice(ImageID("I_ICON_GOLD"), vertical ? new LinearLayoutParams() : nullptr) : new Choice(mm->T("Buy PPSSPP Gold"))); + Choice *gold = parent->Add(portrait ? new Choice(ImageID("I_ICON_GOLD"), portrait ? new LinearLayoutParams() : nullptr) : new Choice(mm->T("Buy PPSSPP Gold"))); gold->OnClick.Add([this](UI::EventParams &) { LaunchBuyGold(this->screenManager()); }); @@ -1196,7 +1196,7 @@ void MainScreen::CreateMainButtons(UI::ViewGroup *parent, bool vertical) { gold->SetShine(true); } - if (!vertical) { + if (!portrait) { parent->Add(new Spacer(25.0)); } @@ -1204,8 +1204,8 @@ void MainScreen::CreateMainButtons(UI::ViewGroup *parent, bool vertical) { // Officially, iOS apps should not have exit buttons. Remove it to maximize app store review chances. // Additionally, the Exit button creates problems on Android. // Also we remove it in the vertical layout on all platforms, just no space. - if (!vertical) { - parent->Add(new Choice(mm->T("Exit"), vertical ? new LinearLayoutParams() : nullptr))->OnClick.Handle(this, &MainScreen::OnExit); + if (!portrait) { + parent->Add(new Choice(mm->T("Exit"), portrait ? new LinearLayoutParams() : nullptr))->OnClick.Handle(this, &MainScreen::OnExit); } #endif }