From ad0d29bf5d881ab619a90ffb8a1f3352eba21615 Mon Sep 17 00:00:00 2001 From: aldrikboy Date: Sat, 23 Dec 2017 19:14:34 +0100 Subject: Communism --- Penguloon/Controls/ControlBase.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'Penguloon/Controls/ControlBase.cs') diff --git a/Penguloon/Controls/ControlBase.cs b/Penguloon/Controls/ControlBase.cs index dea0bd7..42c729e 100644 --- a/Penguloon/Controls/ControlBase.cs +++ b/Penguloon/Controls/ControlBase.cs @@ -24,9 +24,13 @@ namespace Penguloon.Controls public Texture2D BackgroundPressed { get; set; } public Texture2D BackgroundDisabled { get; set; } + public event EventHandler OnMissClick; public event EventHandler OnClick; public event EventHandler OnMove; + public TextAllignment TextAllignment { get; set; } = TextAllignment.CenterMiddle; + public int PaddingTop { get; set; } = 0; + /// /// Base constructor. /// @@ -65,7 +69,7 @@ namespace Penguloon.Controls if (Font == null) return; if (string.IsNullOrWhiteSpace(Text)) return; - ParentScene.DrawText(Font, Text, Position, Size, TextAllignment.CenterMiddle, ForeColor, BorderColor, BorderWidth); + ParentScene.DrawText(Font, Text, new Vector2(Position.X, Position.Y + PaddingTop), Size, TextAllignment, ForeColor, BorderColor, BorderWidth); } /// @@ -105,7 +109,12 @@ namespace Penguloon.Controls return; } else - this.ControlState = ControlState.Idle; + { + this.ControlState = ControlState.Idle; + + if (touchLocations[i].State == TouchLocationState.Released) + OnMissClick?.Invoke(this, EventArgs.Empty); + } } } } -- cgit v1.2.3-70-g09d2