summaryrefslogtreecommitdiff
path: root/src/interface/Button.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-01-23 22:53:57 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-01-23 22:53:57 (GMT)
commitdf72f2580f68a7d0055fcf20dcd65c0be90c52dd (patch)
treeada3c6d3fdc2009f5236ec2a39d661c0bfaaf3e5 /src/interface/Button.cpp
parent2bd571e1598e6baffc717bcb086d89d01929604b (diff)
downloadpowder-df72f2580f68a7d0055fcf20dcd65c0be90c52dd.zip
powder-df72f2580f68a7d0055fcf20dcd65c0be90c52dd.tar.gz
Better element buttons, Save preview WIP
Diffstat (limited to 'src/interface/Button.cpp')
-rw-r--r--src/interface/Button.cpp35
1 files changed, 15 insertions, 20 deletions
diff --git a/src/interface/Button.cpp b/src/interface/Button.cpp
index 2694de5..782d89b 100644
--- a/src/interface/Button.cpp
+++ b/src/interface/Button.cpp
@@ -26,11 +26,10 @@ Button::Button(Window* parent_state, std::string buttonText):
textPosition(ui::Point(0, 0)),
textVAlign(AlignMiddle),
textHAlign(AlignCentre),
- Enabled(true),
- colr(0),
- colg(0),
- colb(0)
+ Enabled(true)
{
+ activeText = background = Colour(0, 0, 0);
+ text = activeBackground = border = activeBorder = Colour(255, 255, 255);
TextPosition();
}
@@ -45,11 +44,10 @@ Button::Button(Point position, Point size, std::string buttonText):
textPosition(ui::Point(0, 0)),
textVAlign(AlignMiddle),
textHAlign(AlignCentre),
- Enabled(true),
- colr(0),
- colg(0),
- colb(0)
+ Enabled(true)
{
+ activeText = background = Colour(0, 0, 0);
+ text = activeBackground = border = activeBorder = Colour(255, 255, 255);
TextPosition();
}
@@ -64,11 +62,10 @@ Button::Button(std::string buttonText):
textPosition(ui::Point(0, 0)),
textVAlign(AlignMiddle),
textHAlign(AlignCentre),
- Enabled(true),
- colr(0),
- colg(0),
- colb(0)
+ Enabled(true)
{
+ activeText = background = Colour(0, 0, 0);
+ text = activeBackground = border = activeBorder = Colour(255, 255, 255);
TextPosition();
}
@@ -137,17 +134,15 @@ void Button::Draw(const Point& screenPos)
{
if(isButtonDown || (isTogglable && toggle))
{
- g->fillrect(Position.X-1, Position.Y-1, Size.X+2, Size.Y+2, 255, 255, 255, 255);
- g->drawtext(Position.X+textPosition.X, Position.Y+textPosition.Y, ButtonText, 0, 0, 0, 255);
+ g->fillrect(Position.X-1, Position.Y-1, Size.X+2, Size.Y+2, activeBackground.Red, activeBackground.Green, activeBackground.Blue, 255);
+ g->drawrect(Position.X, Position.Y, Size.X, Size.Y, activeBorder.Red, activeBorder.Green, activeBorder.Blue, 255);
+ g->drawtext(Position.X+textPosition.X, Position.Y+textPosition.Y, ButtonText, activeText.Red, activeText.Green, activeText.Blue, 255);
}
else
{
- if(isMouseInside)
- g->fillrect(Position.X, Position.Y, Size.X, Size.Y, 20, 20, 20, 255);
- else
- g->fillrect(Position.X, Position.Y, Size.X, Size.Y, colr, colg, colb, 255);
- g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 255, 255, 255, 255);
- g->drawtext(Position.X+textPosition.X, Position.Y+textPosition.Y, ButtonText, 255, 255, 255, 255);
+ g->fillrect(Position.X, Position.Y, Size.X, Size.Y, background.Red, background.Green, background.Blue, 255);
+ g->drawrect(Position.X, Position.Y, Size.X, Size.Y, border.Red, border.Green, border.Blue, 255);
+ g->drawtext(Position.X+textPosition.X, Position.Y+textPosition.Y, ButtonText, text.Red, text.Green, text.Blue, 255);
}
}
else