mirror of
https://github.com/GabsPuNs/Project-Zenith-Main.git
synced 2026-07-12 18:18:28 +00:00
Revert "Refresh localized text on gainFocus for RmlUI menus"
This reverts commit 6399a965d6.
This commit is contained in:
@@ -20,18 +20,6 @@
|
||||
#pragma pop_macro("GetNextSibling")
|
||||
#pragma pop_macro("byte")
|
||||
|
||||
static std::string WStringToUTF8(LPCWSTR wstr)
|
||||
{
|
||||
if (!wstr) return {};
|
||||
size_t wlen = wcslen(wstr);
|
||||
if (wlen == 0) return {};
|
||||
int len = WideCharToMultiByte(CP_UTF8, 0, wstr, (int)wlen, nullptr, 0, nullptr, nullptr);
|
||||
if (len <= 0) return {};
|
||||
std::string result(len, '\0');
|
||||
WideCharToMultiByte(CP_UTF8, 0, wstr, (int)wlen, &result[0], len, nullptr, nullptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
UIScene_SettingsMenu::UIScene_SettingsMenu(int iPad, void *initData, UILayer *parentLayer)
|
||||
: UIScene(iPad, parentLayer)
|
||||
, m_document(nullptr)
|
||||
@@ -61,8 +49,6 @@ UIScene_SettingsMenu::UIScene_SettingsMenu(int iPad, void *initData, UILayer *pa
|
||||
if (elGraphics) elGraphics->SetProperty("display", "none");
|
||||
}
|
||||
|
||||
UpdateLocalizedText();
|
||||
|
||||
// Register button click listeners
|
||||
m_document->GetElementById("options")->AddEventListener(Rml::EventId::Click, this);
|
||||
m_document->GetElementById("audio")->AddEventListener(Rml::EventId::Click, this);
|
||||
@@ -132,30 +118,8 @@ void UIScene_SettingsMenu::updateTooltips()
|
||||
{
|
||||
}
|
||||
|
||||
void UIScene_SettingsMenu::UpdateLocalizedText()
|
||||
{
|
||||
if (!m_document)
|
||||
return;
|
||||
|
||||
auto setText = [this](const Rml::String& id, int ids) {
|
||||
auto* el = m_document->GetElementById(id);
|
||||
if (el) el->SetInnerRML(WStringToUTF8(app.GetString(ids)));
|
||||
};
|
||||
|
||||
setText("options", IDS_OPTIONS);
|
||||
setText("audio", IDS_AUDIO);
|
||||
setText("controls", IDS_CONTROLS);
|
||||
setText("graphics", IDS_GRAPHICS);
|
||||
setText("ui", IDS_USER_INTERFACE);
|
||||
setText("reset_defaults", IDS_RESET_TO_DEFAULTS);
|
||||
setText("confirm_yes", IDS_YES);
|
||||
setText("confirm_no", IDS_NO);
|
||||
}
|
||||
|
||||
void UIScene_SettingsMenu::updateComponents()
|
||||
{
|
||||
UpdateLocalizedText();
|
||||
|
||||
bool bNotInGame = (Minecraft::GetInstance()->level == nullptr);
|
||||
|
||||
if (bNotInGame)
|
||||
|
||||
Reference in New Issue
Block a user