Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
UI|Client: Added shadow behind ProgressWidget’s text
Make it more readable on light backgrounds.
  • Loading branch information
skyjake committed Nov 21, 2013
1 parent 5766fae commit 2ac6c21
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
5 changes: 5 additions & 0 deletions doomsday/client/include/ui/widgets/labelwidget.h
Expand Up @@ -80,6 +80,11 @@ class LabelWidget : public GuiWidget

de::String text() const;

/**
* Returns the actual size of the text in pixels.
*/
de::Vector2ui textSize() const;

/**
* Sets the gap between the text and image. Defaults to "label.gap".
*
Expand Down
5 changes: 5 additions & 0 deletions doomsday/client/src/ui/widgets/labelwidget.cpp
Expand Up @@ -477,6 +477,11 @@ String LabelWidget::text() const
return d->glText.text();
}

Vector2ui LabelWidget::textSize() const
{
return d->textSize();
}

void LabelWidget::setTextGap(DotPath const &styleRuleId)
{
d->gapId = styleRuleId;
Expand Down
12 changes: 8 additions & 4 deletions doomsday/client/src/ui/widgets/progresswidget.cpp
Expand Up @@ -215,10 +215,14 @@ void ProgressWidget::glMakeGeometry(DefaultVertexBuf::Builder &verts)
gradientThick, solidThick, 30,
shadowColor,
root().atlas().imageRectf(root().borderGlow()), 0);
/*verts.makeRing(layout.image.middle(),
shadowRadius - gradientThick, shadowRadius - solidThick, 30,
shadowColor,
root().atlas().imageRectf(root().borderGlow()), 0);*/

// Shadow behind the text.
Rectanglef textBox = Rectanglef::fromSize(textSize());
ui::applyAlignment(ui::AlignCenter, textBox, layout.text);
int const boxSize = textBox.height() * 4;
verts.makeFlexibleFrame(Rectanglef(textBox.midLeft(), textBox.midRight()).expanded(boxSize),
boxSize, Vector4f(shadowColor, shadowColor.w * .75f),
root().atlas().imageRectf(root().borderGlow()));

LabelWidget::glMakeGeometry(verts);

Expand Down

0 comments on commit 2ac6c21

Please sign in to comment.