summaryrefslogtreecommitdiff
path: root/Penguloon/Controls/ControlBase.cs
diff options
context:
space:
mode:
authoraldrikboy <aldrikboy@gmail.com>2017-12-23 19:14:34 +0100
committeraldrikboy <aldrikboy@gmail.com>2017-12-23 19:14:34 +0100
commitad0d29bf5d881ab619a90ffb8a1f3352eba21615 (patch)
treec69fe6ea7212f2d839ca52e3adb523b27dc532b9 /Penguloon/Controls/ControlBase.cs
parent1276593bfbbfcdbac24b48cf8b574da25945d763 (diff)
Communism
Diffstat (limited to 'Penguloon/Controls/ControlBase.cs')
-rw-r--r--Penguloon/Controls/ControlBase.cs13
1 files changed, 11 insertions, 2 deletions
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<ClickArgs> OnClick;
public event EventHandler<MoveArgs> OnMove;
+ public TextAllignment TextAllignment { get; set; } = TextAllignment.CenterMiddle;
+ public int PaddingTop { get; set; } = 0;
+
/// <summary>
/// Base constructor.
/// </summary>
@@ -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);
}
/// <summary>
@@ -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);
+ }
}
}
}