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)
|
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;
|
g_isClosed = false;
|
||||||
}
|
}
|
||||||
else if (!g_isClosed)
|
else if (!g_isClosed)
|
||||||
|
|
|
||||||
|
|
@ -778,7 +778,7 @@ void AchievementMenu::Open()
|
||||||
return std::get<1>(a) > std::get<1>(b);
|
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();
|
ResetSelection();
|
||||||
Game_PlaySound("sys_actstg_pausewinopen");
|
Game_PlaySound("sys_actstg_pausewinopen");
|
||||||
|
|
|
||||||
|
|
@ -260,9 +260,10 @@ void ButtonGuide::Draw()
|
||||||
if (btn.Visibility && !*btn.Visibility)
|
if (btn.Visibility && !*btn.Visibility)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
auto str = Localise(btn.Name.c_str()).c_str();
|
||||||
auto iconWidth = Scale(g_iconWidths[btn.Icon]);
|
auto iconWidth = Scale(g_iconWidths[btn.Icon]);
|
||||||
auto iconHeight = Scale(g_iconHeights[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)
|
if (i > 0)
|
||||||
offsetLeft += textSize.x + iconWidth + textMarginX;
|
offsetLeft += textSize.x + iconWidth + textMarginX;
|
||||||
|
|
@ -270,7 +271,7 @@ void ButtonGuide::Draw()
|
||||||
ImVec2 iconMin = { regionMin.x + offsetLeft - iconWidth - iconMarginX, regionMin.y };
|
ImVec2 iconMin = { regionMin.x + offsetLeft - iconWidth - iconMarginX, regionMin.y };
|
||||||
ImVec2 iconMax = { regionMin.x + offsetLeft - iconMarginX, regionMin.y + iconHeight };
|
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.
|
// Draw right aligned icons.
|
||||||
|
|
@ -284,9 +285,10 @@ void ButtonGuide::Draw()
|
||||||
if (btn.Visibility && !*btn.Visibility)
|
if (btn.Visibility && !*btn.Visibility)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
auto str = Localise(btn.Name.c_str()).c_str();
|
||||||
auto iconWidth = Scale(g_iconWidths[btn.Icon]);
|
auto iconWidth = Scale(g_iconWidths[btn.Icon]);
|
||||||
auto iconHeight = Scale(g_iconHeights[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)
|
if (i < g_buttons.size() - 1)
|
||||||
offsetRight += textSize.x + iconWidth + textMarginX;
|
offsetRight += textSize.x + iconWidth + textMarginX;
|
||||||
|
|
@ -294,7 +296,7 @@ void ButtonGuide::Draw()
|
||||||
ImVec2 iconMin = { regionMax.x - offsetRight - iconWidth - iconMarginX, regionMin.y };
|
ImVec2 iconMin = { regionMax.x - offsetRight - iconWidth - iconMarginX, regionMin.y };
|
||||||
ImVec2 iconMax = { regionMax.x - offsetRight - iconMarginX, regionMin.y + iconHeight };
|
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)
|
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)
|
else if (g_currentPage != WizardPage::Installing && textAlpha >= 1.0)
|
||||||
{
|
{
|
||||||
|
|
@ -875,15 +875,15 @@ static void DrawDescriptionContainer()
|
||||||
|
|
||||||
std::array<Button, 2> buttons =
|
std::array<Button, 2> buttons =
|
||||||
{
|
{
|
||||||
Button(Localise("Common_Select"), selectIcon),
|
Button("Common_Select", selectIcon),
|
||||||
Button(Localise(backKey), backIcon)
|
Button(backKey, backIcon)
|
||||||
};
|
};
|
||||||
|
|
||||||
ButtonGuide::Open(buttons);
|
ButtonGuide::Open(buttons);
|
||||||
}
|
}
|
||||||
else if (g_currentPage == WizardPage::Installing)
|
else if (g_currentPage == WizardPage::Installing)
|
||||||
{
|
{
|
||||||
ButtonGuide::Open(Button(Localise("Common_Cancel"), backIcon));
|
ButtonGuide::Open(Button("Common_Cancel", backIcon));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,7 @@ void DrawNextButtonGuide(bool isController, bool isKeyboard)
|
||||||
if (App::s_isInit)
|
if (App::s_isInit)
|
||||||
icon = EButtonIcon::A;
|
icon = EButtonIcon::A;
|
||||||
|
|
||||||
ButtonGuide::Open(Button(Localise("Common_Next"), icon));
|
ButtonGuide::Open(Button("Common_Next", icon));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ResetSelection()
|
static void ResetSelection()
|
||||||
|
|
@ -425,8 +425,8 @@ void MessageWindow::Draw()
|
||||||
|
|
||||||
std::array<Button, 2> buttons =
|
std::array<Button, 2> buttons =
|
||||||
{
|
{
|
||||||
Button(Localise("Common_Select"), selectIcon),
|
Button("Common_Select", selectIcon),
|
||||||
Button(Localise("Common_Back"), backIcon),
|
Button("Common_Back", backIcon),
|
||||||
};
|
};
|
||||||
|
|
||||||
ButtonGuide::Open(buttons);
|
ButtonGuide::Open(buttons);
|
||||||
|
|
|
||||||
|
|
@ -1737,10 +1737,10 @@ void OptionsMenu::Open(bool isPause, SWA::EMenuType pauseMenuType)
|
||||||
|
|
||||||
std::array<Button, 4> buttons =
|
std::array<Button, 4> buttons =
|
||||||
{
|
{
|
||||||
Button(Localise("Common_Switch"), EButtonIcon::LBRB, EButtonAlignment::Left, &g_isControlsVisible),
|
Button("Common_Switch", EButtonIcon::LBRB, EButtonAlignment::Left, &g_isControlsVisible),
|
||||||
Button(Localise("Common_Reset"), EButtonIcon::X, &g_canReset),
|
Button("Common_Reset", EButtonIcon::X, &g_canReset),
|
||||||
Button(Localise("Common_Select"), EButtonIcon::A, &g_isControlsVisible),
|
Button("Common_Select", EButtonIcon::A, &g_isControlsVisible),
|
||||||
Button(Localise("Common_Back"), EButtonIcon::B, &g_isControlsVisible)
|
Button("Common_Back", EButtonIcon::B, &g_isControlsVisible)
|
||||||
};
|
};
|
||||||
|
|
||||||
ButtonGuide::Open(buttons);
|
ButtonGuide::Open(buttons);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue