public override void Draw(RenderTarget rt)
{
if (!Visible)
return;
RectangleShape button = new RectangleShape(new Vector2f(Width, Height))
{
Position = Position,
FillColor = Color.Black
};
rt.Draw(button);
// Hover
if (mouseIn)
{
RectangleShape buttonHover = new RectangleShape(new Vector2f(Width - 8, Height - 8))
{
Position = Position + new Vector2f(4.0f, 4.0f),
FillColor = Color.Black,
OutlineColor = Color.White,
OutlineThickness = 2.0f
};
rt.Draw(buttonHover);
}
Text text = new Text(value, Assets.LoadFont(Program.DefaultFont))
{
Position = Position + Size / 2.0f,
CharacterSize = 24,
Style = Text.Styles.Bold
};
FloatRect bounds = text.GetGlobalBounds();
text.Position -= new Vector2f(bounds.Width / 2.0f, bounds.Height / 2.0f + 4.0f);
text.Round();
rt.Draw(text);
base.Draw(rt);
}