diff options
Diffstat (limited to '')
-rw-r--r-- | gui/text.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/gui/text.cpp b/gui/text.cpp index 90482fef3..dc7a2d119 100644 --- a/gui/text.cpp +++ b/gui/text.cpp @@ -38,12 +38,16 @@ GUIText::GUIText(xml_node<>* node) mFontHeight = 0; maxWidth = 0; charSkip = 0; + isHighlighted = false; + hasHighlightColor = false; if (!node) return; // Initialize color to solid black memset(&mColor, 0, sizeof(COLOR)); mColor.alpha = 255; + memset(&mHighlightColor, 0, sizeof(COLOR)); + mHighlightColor.alpha = 255; attr = node->first_attribute("color"); if (attr) @@ -51,6 +55,13 @@ GUIText::GUIText(xml_node<>* node) std::string color = attr->value(); ConvertStrToColor(color, &mColor); } + attr = node->first_attribute("highlightcolor"); + if (attr) + { + std::string color = attr->value(); + ConvertStrToColor(color, &mHighlightColor); + hasHighlightColor = true; + } // Load the font, and possibly override the color child = node->first_node("font"); @@ -66,6 +77,14 @@ GUIText::GUIText(xml_node<>* node) std::string color = attr->value(); ConvertStrToColor(color, &mColor); } + + attr = child->first_attribute("highlightcolor"); + if (attr) + { + std::string color = attr->value(); + ConvertStrToColor(color, &mHighlightColor); + hasHighlightColor = true; + } } // Load the placement @@ -117,7 +136,10 @@ int GUIText::Render(void) y -= mFontHeight; } - gr_color(mColor.red, mColor.green, mColor.blue, mColor.alpha); + if (hasHighlightColor && isHighlighted) + gr_color(mHighlightColor.red, mHighlightColor.green, mHighlightColor.blue, mHighlightColor.alpha); + else + gr_color(mColor.red, mColor.green, mColor.blue, mColor.alpha); if (maxWidth) gr_textExW(x, y, displayValue.c_str(), fontResource, maxWidth + x); |