button_guide: scale max width internally

This commit is contained in:
Hyper 2025-02-17 19:15:09 +00:00
parent cede3fa69b
commit 6b6b87879c
4 changed files with 10 additions and 10 deletions

View file

@ -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)

View file

@ -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<Button, 2> buttons =
{
Button("Common_Select", Scale(115), selectIcon),
Button("Common_Select", 115.0f, selectIcon),
Button(backKey, FLT_MAX, backIcon)
};

View file

@ -425,7 +425,7 @@ void MessageWindow::Draw()
std::array<Button, 2> 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<Button, 2> buttons =
{
Button("Common_Select", Scale(115), EButtonIcon::LMB),
Button("Common_Select", 115.0f, EButtonIcon::LMB),
Button("Common_Back", FLT_MAX, EButtonIcon::Escape),
};

View file

@ -1790,10 +1790,10 @@ void OptionsMenu::Open(bool isPause, SWA::EMenuType pauseMenuType)
std::array<Button, 4> 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);