mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 08:04:01 +02:00
Add backgroundColor to TextOverlay
This commit is contained in:
parent
21b839a8b5
commit
cda88bf4af
2 changed files with 14 additions and 1 deletions
|
@ -33,7 +33,7 @@ void TextOverlay::render() {
|
|||
}
|
||||
|
||||
const float MAX_COLOR = 255;
|
||||
glColor4f(0 / MAX_COLOR, 0 / MAX_COLOR, 0 / MAX_COLOR, _alpha);
|
||||
glColor4f(_backgroundColor.red / MAX_COLOR, _backgroundColor.green / MAX_COLOR, _backgroundColor.blue / MAX_COLOR, _alpha);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glVertex2f(_bounds.left(), _bounds.top());
|
||||
|
@ -82,6 +82,18 @@ void TextOverlay::setProperties(const QScriptValue& properties) {
|
|||
setText(text.toVariant().toString());
|
||||
}
|
||||
|
||||
QScriptValue backgroundColor = properties.property("backgroundColor");
|
||||
if (backgroundColor.isValid()) {
|
||||
QScriptValue red = backgroundColor.property("red");
|
||||
QScriptValue green = backgroundColor.property("green");
|
||||
QScriptValue blue = backgroundColor.property("blue");
|
||||
if (red.isValid() && green.isValid() && blue.isValid()) {
|
||||
_backgroundColor.red = red.toVariant().toInt();
|
||||
_backgroundColor.green = green.toVariant().toInt();
|
||||
_backgroundColor.blue = blue.toVariant().toInt();
|
||||
}
|
||||
}
|
||||
|
||||
if (properties.property("leftMargin").isValid()) {
|
||||
setLeftMargin(properties.property("leftMargin").toVariant().toInt());
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ public:
|
|||
private:
|
||||
|
||||
QString _text;
|
||||
xColor _backgroundColor;
|
||||
int _leftMargin;
|
||||
int _topMargin;
|
||||
int _fontSize;
|
||||
|
|
Loading…
Reference in a new issue