mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-10-30 07:11:05 +00:00
Fix localisation not updating in real-time for button guides (#322)
This commit is contained in:
parent
fff96a8528
commit
fcd1673cfc
6 changed files with 19 additions and 17 deletions
|
|
@ -163,7 +163,7 @@ PPC_FUNC(sub_824B0930)
|
|||
|
||||
if (*SWA::SGlobals::ms_IsRenderHud && pHudPause->m_IsShown && !pHudPause->m_Submenu && pHudPause->m_Transition == SWA::eTransitionType_Undefined)
|
||||
{
|
||||
ButtonGuide::Open(Button(Localise("Achievements_Name"), EButtonIcon::Back, EButtonAlignment::Left, EFontQuality::Low));
|
||||
ButtonGuide::Open(Button("Achievements_Name", EButtonIcon::Back, EButtonAlignment::Left, EFontQuality::Low));
|
||||
g_isClosed = false;
|
||||
}
|
||||
else if (!g_isClosed)
|
||||
|
|
|
|||
|
|
@ -778,7 +778,7 @@ void AchievementMenu::Open()
|
|||
return std::get<1>(a) > std::get<1>(b);
|
||||
});
|
||||
|
||||
ButtonGuide::Open(Button(Localise("Common_Back"), EButtonIcon::B));
|
||||
ButtonGuide::Open(Button("Common_Back", EButtonIcon::B));
|
||||
|
||||
ResetSelection();
|
||||
Game_PlaySound("sys_actstg_pausewinopen");
|
||||
|
|
|
|||
|
|
@ -260,9 +260,10 @@ void ButtonGuide::Draw()
|
|||
if (btn.Visibility && !*btn.Visibility)
|
||||
continue;
|
||||
|
||||
auto str = Localise(btn.Name.c_str()).c_str();
|
||||
auto iconWidth = Scale(g_iconWidths[btn.Icon]);
|
||||
auto iconHeight = Scale(g_iconHeights[btn.Icon]);
|
||||
auto textSize = g_fntNewRodin->CalcTextSizeA(fontSize, FLT_MAX, 0, btn.Name.c_str());
|
||||
auto textSize = g_fntNewRodin->CalcTextSizeA(fontSize, FLT_MAX, 0, str);
|
||||
|
||||
if (i > 0)
|
||||
offsetLeft += textSize.x + iconWidth + textMarginX;
|
||||
|
|
@ -270,7 +271,7 @@ void ButtonGuide::Draw()
|
|||
ImVec2 iconMin = { regionMin.x + offsetLeft - iconWidth - iconMarginX, regionMin.y };
|
||||
ImVec2 iconMax = { regionMin.x + offsetLeft - iconMarginX, regionMin.y + iconHeight };
|
||||
|
||||
DrawGuide(&offsetLeft, regionMin, regionMax, btn.Icon, btn.Alignment, iconMin, iconMax, btn.FontQuality, textSize, fontSize, btn.Name.c_str());
|
||||
DrawGuide(&offsetLeft, regionMin, regionMax, btn.Icon, btn.Alignment, iconMin, iconMax, btn.FontQuality, textSize, fontSize, str);
|
||||
}
|
||||
|
||||
// Draw right aligned icons.
|
||||
|
|
@ -284,9 +285,10 @@ void ButtonGuide::Draw()
|
|||
if (btn.Visibility && !*btn.Visibility)
|
||||
continue;
|
||||
|
||||
auto str = Localise(btn.Name.c_str()).c_str();
|
||||
auto iconWidth = Scale(g_iconWidths[btn.Icon]);
|
||||
auto iconHeight = Scale(g_iconHeights[btn.Icon]);
|
||||
auto textSize = g_fntNewRodin->CalcTextSizeA(fontSize, FLT_MAX, 0, btn.Name.c_str());
|
||||
auto textSize = g_fntNewRodin->CalcTextSizeA(fontSize, FLT_MAX, 0, str);
|
||||
|
||||
if (i < g_buttons.size() - 1)
|
||||
offsetRight += textSize.x + iconWidth + textMarginX;
|
||||
|
|
@ -294,7 +296,7 @@ void ButtonGuide::Draw()
|
|||
ImVec2 iconMin = { regionMax.x - offsetRight - iconWidth - iconMarginX, regionMin.y };
|
||||
ImVec2 iconMax = { regionMax.x - offsetRight - iconMarginX, regionMin.y + iconHeight };
|
||||
|
||||
DrawGuide(&offsetRight, regionMin, regionMax, btn.Icon, btn.Alignment, iconMin, iconMax, btn.FontQuality, textSize, fontSize, btn.Name.c_str());
|
||||
DrawGuide(&offsetRight, regionMin, regionMax, btn.Icon, btn.Alignment, iconMin, iconMax, btn.FontQuality, textSize, fontSize, str);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -863,7 +863,7 @@ static void DrawDescriptionContainer()
|
|||
|
||||
if (g_currentPage == WizardPage::InstallSucceeded && textAlpha >= 1.0)
|
||||
{
|
||||
ButtonGuide::Open(Button(Localise("Common_Select"), selectIcon));
|
||||
ButtonGuide::Open(Button("Common_Select", selectIcon));
|
||||
}
|
||||
else if (g_currentPage != WizardPage::Installing && textAlpha >= 1.0)
|
||||
{
|
||||
|
|
@ -875,15 +875,15 @@ static void DrawDescriptionContainer()
|
|||
|
||||
std::array<Button, 2> buttons =
|
||||
{
|
||||
Button(Localise("Common_Select"), selectIcon),
|
||||
Button(Localise(backKey), backIcon)
|
||||
Button("Common_Select", selectIcon),
|
||||
Button(backKey, backIcon)
|
||||
};
|
||||
|
||||
ButtonGuide::Open(buttons);
|
||||
}
|
||||
else if (g_currentPage == WizardPage::Installing)
|
||||
{
|
||||
ButtonGuide::Open(Button(Localise("Common_Cancel"), backIcon));
|
||||
ButtonGuide::Open(Button("Common_Cancel", backIcon));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ void DrawNextButtonGuide(bool isController, bool isKeyboard)
|
|||
if (App::s_isInit)
|
||||
icon = EButtonIcon::A;
|
||||
|
||||
ButtonGuide::Open(Button(Localise("Common_Next"), icon));
|
||||
ButtonGuide::Open(Button("Common_Next", icon));
|
||||
}
|
||||
|
||||
static void ResetSelection()
|
||||
|
|
@ -425,8 +425,8 @@ void MessageWindow::Draw()
|
|||
|
||||
std::array<Button, 2> buttons =
|
||||
{
|
||||
Button(Localise("Common_Select"), selectIcon),
|
||||
Button(Localise("Common_Back"), backIcon),
|
||||
Button("Common_Select", selectIcon),
|
||||
Button("Common_Back", backIcon),
|
||||
};
|
||||
|
||||
ButtonGuide::Open(buttons);
|
||||
|
|
|
|||
|
|
@ -1737,10 +1737,10 @@ void OptionsMenu::Open(bool isPause, SWA::EMenuType pauseMenuType)
|
|||
|
||||
std::array<Button, 4> buttons =
|
||||
{
|
||||
Button(Localise("Common_Switch"), EButtonIcon::LBRB, EButtonAlignment::Left, &g_isControlsVisible),
|
||||
Button(Localise("Common_Reset"), EButtonIcon::X, &g_canReset),
|
||||
Button(Localise("Common_Select"), EButtonIcon::A, &g_isControlsVisible),
|
||||
Button(Localise("Common_Back"), EButtonIcon::B, &g_isControlsVisible)
|
||||
Button("Common_Switch", EButtonIcon::LBRB, EButtonAlignment::Left, &g_isControlsVisible),
|
||||
Button("Common_Reset", EButtonIcon::X, &g_canReset),
|
||||
Button("Common_Select", EButtonIcon::A, &g_isControlsVisible),
|
||||
Button("Common_Back", EButtonIcon::B, &g_isControlsVisible)
|
||||
};
|
||||
|
||||
ButtonGuide::Open(buttons);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue