mirror of
https://github.com/overte-org/overte.git
synced 2025-07-29 20:39:56 +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;
|
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);
|
glBegin(GL_QUADS);
|
||||||
glVertex2f(_bounds.left(), _bounds.top());
|
glVertex2f(_bounds.left(), _bounds.top());
|
||||||
|
@ -82,6 +82,18 @@ void TextOverlay::setProperties(const QScriptValue& properties) {
|
||||||
setText(text.toVariant().toString());
|
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()) {
|
if (properties.property("leftMargin").isValid()) {
|
||||||
setLeftMargin(properties.property("leftMargin").toVariant().toInt());
|
setLeftMargin(properties.property("leftMargin").toVariant().toInt());
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,7 @@ public:
|
||||||
private:
|
private:
|
||||||
|
|
||||||
QString _text;
|
QString _text;
|
||||||
|
xColor _backgroundColor;
|
||||||
int _leftMargin;
|
int _leftMargin;
|
||||||
int _topMargin;
|
int _topMargin;
|
||||||
int _fontSize;
|
int _fontSize;
|
||||||
|
|
Loading…
Reference in a new issue