From 6b6b87879c156e0e7d942e5d3887ee6142b2b976 Mon Sep 17 00:00:00 2001 From: Hyper <34012267+hyperbx@users.noreply.github.com> Date: Mon, 17 Feb 2025 19:15:09 +0000 Subject: [PATCH] button_guide: scale max width internally --- UnleashedRecomp/ui/button_guide.cpp | 4 ++-- UnleashedRecomp/ui/installer_wizard.cpp | 4 ++-- UnleashedRecomp/ui/message_window.cpp | 4 ++-- UnleashedRecomp/ui/options_menu.cpp | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/UnleashedRecomp/ui/button_guide.cpp b/UnleashedRecomp/ui/button_guide.cpp index 1f0d1619..e5457edf 100644 --- a/UnleashedRecomp/ui/button_guide.cpp +++ b/UnleashedRecomp/ui/button_guide.cpp @@ -260,7 +260,7 @@ void ButtonGuide::Draw() auto iconWidth = Scale(g_iconWidths[btn.Icon]); auto iconHeight = Scale(g_iconHeights[btn.Icon]); auto textWidth = g_fntNewRodin->CalcTextSizeA(fontSize, FLT_MAX, 0, str).x; - auto maxWidth = btn.MaxWidth == FLT_MAX ? textWidth : btn.MaxWidth; + auto maxWidth = btn.MaxWidth == FLT_MAX ? textWidth : Scale(btn.MaxWidth); auto textScale = std::min(1.0f, maxWidth / textWidth); if (i > 0) @@ -287,7 +287,7 @@ void ButtonGuide::Draw() auto iconWidth = Scale(g_iconWidths[btn.Icon]); auto iconHeight = Scale(g_iconHeights[btn.Icon]); auto textWidth = g_fntNewRodin->CalcTextSizeA(fontSize, FLT_MAX, 0, str).x; - auto maxWidth = btn.MaxWidth == FLT_MAX ? textWidth : btn.MaxWidth; + auto maxWidth = btn.MaxWidth == FLT_MAX ? textWidth : Scale(btn.MaxWidth); auto textScale = std::min(1.0f, maxWidth / textWidth); if (i < g_buttons.size() - 1) diff --git a/UnleashedRecomp/ui/installer_wizard.cpp b/UnleashedRecomp/ui/installer_wizard.cpp index 16f5770a..7fc70a25 100644 --- a/UnleashedRecomp/ui/installer_wizard.cpp +++ b/UnleashedRecomp/ui/installer_wizard.cpp @@ -872,7 +872,7 @@ static void DrawDescriptionContainer() if (g_currentPage == WizardPage::InstallSucceeded && textAlpha >= 1.0) { - ButtonGuide::Open(Button("Common_Select", Scale(115), selectIcon)); + ButtonGuide::Open(Button("Common_Select", 115.0f, selectIcon)); } else if (g_currentPage != WizardPage::Installing && textAlpha >= 1.0) { @@ -884,7 +884,7 @@ static void DrawDescriptionContainer() std::array buttons = { - Button("Common_Select", Scale(115), selectIcon), + Button("Common_Select", 115.0f, selectIcon), Button(backKey, FLT_MAX, backIcon) }; diff --git a/UnleashedRecomp/ui/message_window.cpp b/UnleashedRecomp/ui/message_window.cpp index 5e7130d2..5502eb89 100644 --- a/UnleashedRecomp/ui/message_window.cpp +++ b/UnleashedRecomp/ui/message_window.cpp @@ -425,7 +425,7 @@ void MessageWindow::Draw() std::array buttons = { - Button("Common_Select", Scale(115), selectIcon), + Button("Common_Select", 115.0f, selectIcon), Button("Common_Back", FLT_MAX, backIcon), }; @@ -470,7 +470,7 @@ void MessageWindow::Draw() std::array buttons = { - Button("Common_Select", Scale(115), EButtonIcon::LMB), + Button("Common_Select", 115.0f, EButtonIcon::LMB), Button("Common_Back", FLT_MAX, EButtonIcon::Escape), }; diff --git a/UnleashedRecomp/ui/options_menu.cpp b/UnleashedRecomp/ui/options_menu.cpp index 5c1f3548..5d453412 100644 --- a/UnleashedRecomp/ui/options_menu.cpp +++ b/UnleashedRecomp/ui/options_menu.cpp @@ -1790,10 +1790,10 @@ void OptionsMenu::Open(bool isPause, SWA::EMenuType pauseMenuType) std::array buttons = { - Button("Common_Switch", Scale(115), EButtonIcon::LBRB, EButtonAlignment::Left, &g_isControlsVisible), - Button("Common_Reset", Scale(110), EButtonIcon::X, &g_canReset), - Button("Common_Select", Scale(115), EButtonIcon::A, &g_isControlsVisible), - Button("Common_Back", Scale(65), EButtonIcon::B, &g_isControlsVisible) + Button("Common_Switch", 115.0f, EButtonIcon::LBRB, EButtonAlignment::Left, &g_isControlsVisible), + Button("Common_Reset", 110.0f, EButtonIcon::X, &g_canReset), + Button("Common_Select", 115.0f, EButtonIcon::A, &g_isControlsVisible), + Button("Common_Back", 65.0f, EButtonIcon::B, &g_isControlsVisible) }; ButtonGuide::Open(buttons);