Skip to content

Commit 4eb3baa

Browse files
authoredFeb 1, 2020
StaticText: Reset background on EnrichedString change (#9340)
This also fixes the F6 profiler background color -> now controlled by EnrichedString
1 parent 7d29611 commit 4eb3baa

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed
 

Diff for: ‎src/client/gameui.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ void GameUI::init()
8282
core::rect<s32>(0, 0, 0, 0), false, false, guiroot);
8383
m_guitext_profiler->setOverrideFont(g_fontengine->getFont(
8484
g_fontengine->getDefaultFontSize() * 0.9f, FM_Mono));
85-
m_guitext_profiler->setBackgroundColor(video::SColor(120, 0, 0, 0));
8685
m_guitext_profiler->setVisible(false);
8786
}
8887

@@ -246,11 +245,12 @@ void GameUI::updateProfiler()
246245
int lines = g_profiler->print(os, m_profiler_current_page, m_profiler_max_page);
247246
++lines;
248247

249-
std::wstring text = utf8_to_wide(os.str());
250-
setStaticText(m_guitext_profiler, text.c_str());
248+
EnrichedString str(utf8_to_wide(os.str()));
249+
str.setBackground(video::SColor(120, 0, 0, 0));
250+
setStaticText(m_guitext_profiler, str);
251251

252252
core::dimension2d<u32> size = m_guitext_profiler->getOverrideFont()->
253-
getDimension(text.c_str());
253+
getDimension(str.c_str());
254254
core::position2di upper_left(6, 50);
255255
core::position2di lower_right = upper_left;
256256
lower_right.X += size.Width + 10;

Diff for: ‎src/irrlicht_changes/static_text.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,10 @@ void StaticText::updateText()
308308
const EnrichedString &cText = ColoredText;
309309
BrokenText.clear();
310310

311-
if (cText.hasBackground()) {
311+
if (cText.hasBackground())
312312
setBackgroundColor(cText.getBackground());
313-
}
313+
else
314+
setDrawBackground(false);
314315

315316
if (!WordWrap) {
316317
BrokenText.push_back(cText);

0 commit comments

Comments
 (0)
Please sign in to comment.