Moar button appearance

This commit is contained in:
Simon Robertshaw
2012-05-23 20:25:35 +01:00
parent f41ab864ef
commit f8fcd73b20
5 changed files with 8 additions and 6 deletions

View File

@@ -17,8 +17,8 @@ namespace style {
ui::Colour Colour::ConfirmButton = ui::Colour(255, 255, 50); ui::Colour Colour::ConfirmButton = ui::Colour(255, 255, 50);
ui::Colour Colour::ActiveBorder = ui::Colour(255, 255, 255); ui::Colour Colour::ActiveBorder = ui::Colour(255, 255, 255);
ui::Colour Colour::InactiveBorder = ui::Colour(180, 180, 180); ui::Colour Colour::InactiveBorder = ui::Colour(100, 100, 100);
ui::Colour Colour::ActiveBackground = ui::Colour(50, 50, 50); ui::Colour Colour::ActiveBackground = ui::Colour(50, 50, 50);
ui::Colour Colour::InactiveBackground = ui::Colour(0, 0, 0); ui::Colour Colour::InactiveBackground = ui::Colour(0, 0, 0);
} }

View File

@@ -17,6 +17,7 @@ namespace ui
BackgroundHover(30, 30, 30), BackgroundHover(30, 30, 30),
BackgroundInactive(0, 0, 0), BackgroundInactive(0, 0, 0),
BackgroundActive(255, 255, 255), BackgroundActive(255, 255, 255),
BackgroundDisabled(100, 100, 100),
TextHover(255, 255, 255), TextHover(255, 255, 255),
TextInactive(255, 255, 255), TextInactive(255, 255, 255),
@@ -29,4 +30,4 @@ namespace ui
icon(NoIcon) icon(NoIcon)
{}; {};
} }

View File

@@ -33,6 +33,7 @@ namespace ui
ui::Colour BackgroundHover; ui::Colour BackgroundHover;
ui::Colour BackgroundInactive; ui::Colour BackgroundInactive;
ui::Colour BackgroundActive; ui::Colour BackgroundActive;
ui::Colour BackgroundDisabled;
ui::Colour TextHover; ui::Colour TextHover;
ui::Colour TextInactive; ui::Colour TextInactive;

View File

@@ -102,7 +102,7 @@ void Button::Draw(const Point& screenPos)
else else
{ {
g->fillrect(Position.X+1, Position.Y+1, Size.X-2, Size.Y-2, Appearance.BackgroundInactive.Red, Appearance.BackgroundInactive.Green, Appearance.BackgroundInactive.Blue, 180); g->fillrect(Position.X+1, Position.Y+1, Size.X-2, Size.Y-2, Appearance.BackgroundInactive.Red, Appearance.BackgroundInactive.Green, Appearance.BackgroundInactive.Blue, 180);
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 180, 180, 180, 255); g->drawrect(Position.X, Position.Y, Size.X, Size.Y, Appearance.BackgroundDisabled.Red, Appearance.BackgroundDisabled.Green, Appearance.BackgroundDisabled.Blue, Appearance.BackgroundDisabled.Alpha);
g->drawtext(Position.X+textPosition.X, Position.Y+textPosition.Y, buttonDisplayText, 180, 180, 180, 255); g->drawtext(Position.X+textPosition.X, Position.Y+textPosition.Y, buttonDisplayText, 180, 180, 180, 255);
} }
if(Appearance.icon) if(Appearance.icon)

View File

@@ -66,7 +66,7 @@ void Component::TextPosition(std::string displayText)
textWidth-=1; textWidth-=1;
if(Appearance.icon) if(Appearance.icon)
{ {
textWidth += 15; textWidth += 13;
} }
int textAreaWidth = Size.X-(Appearance.Margin.Right+Appearance.Margin.Left); int textAreaWidth = Size.X-(Appearance.Margin.Right+Appearance.Margin.Left);
@@ -99,7 +99,7 @@ void Component::TextPosition(std::string displayText)
} }
if(Appearance.icon) if(Appearance.icon)
{ {
iconPosition = textPosition-ui::Point(0, 1); iconPosition = textPosition;//-ui::Point(0, 1);
textPosition.X += 15; textPosition.X += 15;
} }
} }