Skip to content

Commit

Permalink
UI|Client|GuiRootWidget: Added tiny dot texture, tweaked frame texture
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Aug 30, 2013
1 parent 734c12b commit 629ea83
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
1 change: 1 addition & 0 deletions doomsday/client/include/ui/framework/guirootwidget.h
Expand Up @@ -56,6 +56,7 @@ class GuiRootWidget : public de::RootWidget
de::Id gradientFrame() const;
de::Id borderGlow() const;
de::Id toggleOnOff() const;
de::Id tinyDot() const;

static de::GLShaderBank &shaders();

Expand Down
58 changes: 58 additions & 0 deletions doomsday/client/src/ui/framework/guirootwidget.cpp
Expand Up @@ -40,6 +40,7 @@ DENG2_PIMPL(GuiRootWidget)
Id gradientFrame;
Id borderGlow;
Id toggleOnOff;
Id tinyDot;
bool noFramesDrawnYet;

Instance(Public *i, ClientWindow *win)
Expand Down Expand Up @@ -95,6 +96,12 @@ DENG2_PIMPL(GuiRootWidget)
QImage frame(QSize(12, 12), QImage::Format_ARGB32);
frame.fill(QColor(255, 255, 255, 0).rgba());
QPainter painter(&frame);
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setPen(QPen(QColor(255, 255, 255, 255), 3));
painter.setBrush(Qt::NoBrush);//QColor(255, 255, 255, 255));
painter.drawEllipse(QPoint(6, 6), 4, 4);
/*
painter.setCompositionMode(QPainter::CompositionMode_Source);
painter.setBrush(Qt::NoBrush);
painter.setPen(QColor(255, 255, 255, 32));
painter.drawRect(QRect(1, 1, 9, 9));
Expand All @@ -104,6 +111,39 @@ DENG2_PIMPL(GuiRootWidget)
painter.drawRect(QRect(3, 3, 5, 5));
painter.setPen(QColor(255, 255, 255, 255));
painter.drawRect(QRect(4, 4, 3, 3));
{
painter.setPen(QColor(255, 255, 255, 192));
QPointF const points[4] = {
QPointF(4, 4), QPointF(4, 7),
QPointF(7, 4), QPointF(7, 7)
};
painter.drawPoints(points, 4);
}
{
painter.setPen(QColor(255, 255, 255, 96));
QPointF const points[4] = {
QPointF(3, 3), QPointF(3, 8),
QPointF(8, 3), QPointF(8, 8)
};
painter.drawPoints(points, 4);
}
{
painter.setPen(QColor(255, 255, 255, 48));
QPointF const points[4] = {
QPointF(2, 2), QPointF(2, 9),
QPointF(9, 2), QPointF(9, 9)
};
painter.drawPoints(points, 4);
}
{
painter.setPen(QColor(255, 255, 255, 16));
QPointF const points[4] = {
QPointF(1, 1), QPointF(1, 10),
QPointF(10, 1), QPointF(10, 10)
};
painter.drawPoints(points, 4);
}
*/
gradientFrame = atlas->alloc(frame);
}

Expand All @@ -112,6 +152,18 @@ DENG2_PIMPL(GuiRootWidget)

// On/Off toggle.
toggleOnOff = atlas->alloc(st.images().image("toggle.onoff"));

// Tiny dot.
{
QImage dot(QSize(5, 5), QImage::Format_ARGB32);
dot.fill(QColor(255, 255, 255, 0).rgba());
QPainter painter(&dot);
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setPen(Qt::NoPen);
painter.setBrush(Qt::white);
painter.drawEllipse(QPointF(2.5f, 2.5f), 2, 2);
tinyDot = atlas->alloc(dot);
}
}
}
};
Expand Down Expand Up @@ -172,6 +224,12 @@ Id GuiRootWidget::toggleOnOff() const
return d->toggleOnOff;
}

Id GuiRootWidget::tinyDot() const
{
d->initAtlas();
return d->tinyDot;
}

GLShaderBank &GuiRootWidget::shaders()
{
return ClientApp::glShaderBank();
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/src/ui/framework/guiwidget.cpp
Expand Up @@ -603,7 +603,7 @@ void GuiWidget::glMakeGeometry(DefaultVertexBuf::Builder &verts)
switch(d->background.type)
{
case Background::GradientFrame:
verts.makeFlexibleFrame(rule().recti(),
verts.makeFlexibleFrame(rule().recti().shrunk(1),
d->background.thickness,
d->background.color,
root().atlas().imageRectf(root().gradientFrame()));
Expand Down

0 comments on commit 629ea83

Please sign in to comment.