forked from Mirrorlandia_minetest/minetest
StaticText: Reset background on EnrichedString change (#9340)
This also fixes the F6 profiler background color -> now controlled by EnrichedString
This commit is contained in:
parent
7d29611c1b
commit
4eb3baa51e
@ -82,7 +82,6 @@ void GameUI::init()
|
|||||||
core::rect<s32>(0, 0, 0, 0), false, false, guiroot);
|
core::rect<s32>(0, 0, 0, 0), false, false, guiroot);
|
||||||
m_guitext_profiler->setOverrideFont(g_fontengine->getFont(
|
m_guitext_profiler->setOverrideFont(g_fontengine->getFont(
|
||||||
g_fontengine->getDefaultFontSize() * 0.9f, FM_Mono));
|
g_fontengine->getDefaultFontSize() * 0.9f, FM_Mono));
|
||||||
m_guitext_profiler->setBackgroundColor(video::SColor(120, 0, 0, 0));
|
|
||||||
m_guitext_profiler->setVisible(false);
|
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);
|
int lines = g_profiler->print(os, m_profiler_current_page, m_profiler_max_page);
|
||||||
++lines;
|
++lines;
|
||||||
|
|
||||||
std::wstring text = utf8_to_wide(os.str());
|
EnrichedString str(utf8_to_wide(os.str()));
|
||||||
setStaticText(m_guitext_profiler, text.c_str());
|
str.setBackground(video::SColor(120, 0, 0, 0));
|
||||||
|
setStaticText(m_guitext_profiler, str);
|
||||||
|
|
||||||
core::dimension2d<u32> size = m_guitext_profiler->getOverrideFont()->
|
core::dimension2d<u32> size = m_guitext_profiler->getOverrideFont()->
|
||||||
getDimension(text.c_str());
|
getDimension(str.c_str());
|
||||||
core::position2di upper_left(6, 50);
|
core::position2di upper_left(6, 50);
|
||||||
core::position2di lower_right = upper_left;
|
core::position2di lower_right = upper_left;
|
||||||
lower_right.X += size.Width + 10;
|
lower_right.X += size.Width + 10;
|
||||||
|
@ -308,9 +308,10 @@ void StaticText::updateText()
|
|||||||
const EnrichedString &cText = ColoredText;
|
const EnrichedString &cText = ColoredText;
|
||||||
BrokenText.clear();
|
BrokenText.clear();
|
||||||
|
|
||||||
if (cText.hasBackground()) {
|
if (cText.hasBackground())
|
||||||
setBackgroundColor(cText.getBackground());
|
setBackgroundColor(cText.getBackground());
|
||||||
}
|
else
|
||||||
|
setDrawBackground(false);
|
||||||
|
|
||||||
if (!WordWrap) {
|
if (!WordWrap) {
|
||||||
BrokenText.push_back(cText);
|
BrokenText.push_back(cText);
|
||||||
|
Loading…
Reference in New Issue
Block a user