diff options
author | SmallJoker <SmallJoker@users.noreply.github.com> | 2020-02-01 20:41:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-01 20:41:32 +0100 |
commit | 4eb3baa51ed95d7661bbeecbbdf040d51ac32187 (patch) | |
tree | 48fbd24f6434aa957e1ebf0f6c7f098b5e6b944a /src | |
parent | 7d29611c1b619b6a336fc0505d993fbe539a62b9 (diff) | |
download | minetest-4eb3baa51ed95d7661bbeecbbdf040d51ac32187.tar.gz minetest-4eb3baa51ed95d7661bbeecbbdf040d51ac32187.tar.bz2 minetest-4eb3baa51ed95d7661bbeecbbdf040d51ac32187.zip |
StaticText: Reset background on EnrichedString change (#9340)
This also fixes the F6 profiler background color -> now controlled by EnrichedString
Diffstat (limited to 'src')
-rw-r--r-- | src/client/gameui.cpp | 8 | ||||
-rw-r--r-- | src/irrlicht_changes/static_text.cpp | 5 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/client/gameui.cpp b/src/client/gameui.cpp index 3c7ed54b2..138dfb4da 100644 --- a/src/client/gameui.cpp +++ b/src/client/gameui.cpp @@ -82,7 +82,6 @@ void GameUI::init() core::rect<s32>(0, 0, 0, 0), false, false, guiroot); m_guitext_profiler->setOverrideFont(g_fontengine->getFont( g_fontengine->getDefaultFontSize() * 0.9f, FM_Mono)); - m_guitext_profiler->setBackgroundColor(video::SColor(120, 0, 0, 0)); m_guitext_profiler->setVisible(false); } @@ -246,11 +245,12 @@ void GameUI::updateProfiler() int lines = g_profiler->print(os, m_profiler_current_page, m_profiler_max_page); ++lines; - std::wstring text = utf8_to_wide(os.str()); - setStaticText(m_guitext_profiler, text.c_str()); + EnrichedString str(utf8_to_wide(os.str())); + str.setBackground(video::SColor(120, 0, 0, 0)); + setStaticText(m_guitext_profiler, str); core::dimension2d<u32> size = m_guitext_profiler->getOverrideFont()-> - getDimension(text.c_str()); + getDimension(str.c_str()); core::position2di upper_left(6, 50); core::position2di lower_right = upper_left; lower_right.X += size.Width + 10; diff --git a/src/irrlicht_changes/static_text.cpp b/src/irrlicht_changes/static_text.cpp index 39b34d17c..bf61cd64e 100644 --- a/src/irrlicht_changes/static_text.cpp +++ b/src/irrlicht_changes/static_text.cpp @@ -308,9 +308,10 @@ void StaticText::updateText() const EnrichedString &cText = ColoredText; BrokenText.clear(); - if (cText.hasBackground()) { + if (cText.hasBackground()) setBackgroundColor(cText.getBackground()); - } + else + setDrawBackground(false); if (!WordWrap) { BrokenText.push_back(cText); |