Skip to content

Commit

Permalink
Replace all actual uses of irrlicht CGUIStaticText with our StaticText
Browse files Browse the repository at this point in the history
  • Loading branch information
Desour authored and sfan5 committed Aug 14, 2023
1 parent d75c956 commit 7e7aceb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
3 changes: 2 additions & 1 deletion src/client/renderingengine.cpp
Expand Up @@ -37,6 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "gettext.h"
#include "filesys.h"
#include "../gui/guiSkin.h"
#include "irrlicht_changes/static_text.h"
#include "irr_ptr.h"

RenderingEngine *RenderingEngine::s_singleton = nullptr;
Expand Down Expand Up @@ -235,7 +236,7 @@ void RenderingEngine::draw_load_screen(const std::wstring &text,
core::rect<s32> textrect(center - textsize / 2, center + textsize / 2);

gui::IGUIStaticText *guitext =
guienv->addStaticText(text.c_str(), textrect, false, false);
gui::StaticText::add(guienv, text, textrect, false, false);
guitext->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);

if (sky && g_settings->getBool("menu_clouds")) {
Expand Down
12 changes: 6 additions & 6 deletions src/gui/guiKeyChangeMenu.cpp
Expand Up @@ -123,8 +123,8 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
core::rect<s32> rect(0, 0, 600 * s, 40 * s);
rect += topleft + v2s32(25 * s, 3 * s);
//gui::IGUIStaticText *t =
Environment->addStaticText(wstrgettext("Keybindings.").c_str(),
rect, false, true, this, -1);
gui::StaticText::add(Environment, wstrgettext("Keybindings."), rect,
false, true, this, -1);
//t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
}

Expand All @@ -138,8 +138,8 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
{
core::rect<s32> rect(0, 0, 150 * s, 20 * s);
rect += topleft + v2s32(offset.X, offset.Y);
Environment->addStaticText(k->button_name.c_str(), rect, false, true,
this, -1);
gui::StaticText::add(Environment, k->button_name, rect,
false, true, this, -1);
}

{
Expand Down Expand Up @@ -300,8 +300,8 @@ bool GUIKeyChangeMenu::OnEvent(const SEvent& event)
if (key_in_use && !this->key_used_text) {
core::rect<s32> rect(0, 0, 600, 40);
rect += v2s32(0, 0) + v2s32(25, 30);
this->key_used_text = Environment->addStaticText(
wstrgettext("Key already in use").c_str(),
this->key_used_text = gui::StaticText::add(Environment,
wstrgettext("Key already in use"),
rect, false, true, this, -1);
} else if (!key_in_use && this->key_used_text) {
this->key_used_text->remove();
Expand Down
14 changes: 7 additions & 7 deletions src/gui/guiPasswordChange.cpp
Expand Up @@ -89,7 +89,7 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
{
core::rect<s32> rect(0, 0, 150 * s, 20 * s);
rect += topleft_client + v2s32(25 * s, ypos + 6 * s);
Environment->addStaticText(wstrgettext("Old Password").c_str(), rect,
gui::StaticText::add(Environment, wstrgettext("Old Password"), rect,
false, true, this, -1);
}
{
Expand All @@ -104,8 +104,8 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
{
core::rect<s32> rect(0, 0, 150 * s, 20 * s);
rect += topleft_client + v2s32(25 * s, ypos + 6 * s);
Environment->addStaticText(wstrgettext("New Password").c_str(), rect, false, true,
this, -1);
gui::StaticText::add(Environment, wstrgettext("New Password"), rect,
false, true, this, -1);
}
{
core::rect<s32> rect(0, 0, 230 * s, 30 * s);
Expand All @@ -118,7 +118,7 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
{
core::rect<s32> rect(0, 0, 150 * s, 20 * s);
rect += topleft_client + v2s32(25 * s, ypos + 6 * s);
Environment->addStaticText(wstrgettext("Confirm Password").c_str(), rect,
gui::StaticText::add(Environment, wstrgettext("Confirm Password"), rect,
false, true, this, -1);
}
{
Expand Down Expand Up @@ -147,9 +147,9 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
{
core::rect<s32> rect(0, 0, 300 * s, 20 * s);
rect += topleft_client + v2s32(35 * s, ypos);
IGUIElement *e = Environment->addStaticText(
wstrgettext("Passwords do not match!").c_str(), rect, false,
true, this, ID_message);
IGUIElement *e = gui::StaticText::add(
Environment, wstrgettext("Passwords do not match!"), rect,
false, true, this, ID_message);
e->setVisible(false);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/guiVolumeChange.cpp
Expand Up @@ -73,7 +73,7 @@ void GUIVolumeChange::regenerateGui(v2u32 screensize)
core::rect<s32> rect(0, 0, 160 * s, 20 * s);
rect = rect + v2s32(size.X / 2 - 80 * s, size.Y / 2 - 70 * s);

Environment->addStaticText(fwgettext("Sound Volume: %d%%", volume).c_str(),
StaticText::add(Environment, fwgettext("Sound Volume: %d%%", volume),
rect, false, true, this, ID_soundText);
}
{
Expand Down

0 comments on commit 7e7aceb

Please sign in to comment.