summaryrefslogtreecommitdiff
path: root/Penguloon/Controls/Checkbox.cs
diff options
context:
space:
mode:
authoraldrikboy <aldrikboy@gmail.com>2018-01-18 11:04:53 +0100
committeraldrikboy <aldrikboy@gmail.com>2018-01-18 11:04:53 +0100
commit2cb22a74aed80e2cce68f16b0821a690c7c05b7a (patch)
tree6a7a254662ebf795358d971f271e7a7f41484bb6 /Penguloon/Controls/Checkbox.cs
parentaa6972a5d052d1f57dfda3dadb79fcd5d8ded30b (diff)
new levels, auto round start
Diffstat (limited to 'Penguloon/Controls/Checkbox.cs')
-rw-r--r--Penguloon/Controls/Checkbox.cs44
1 files changed, 44 insertions, 0 deletions
diff --git a/Penguloon/Controls/Checkbox.cs b/Penguloon/Controls/Checkbox.cs
new file mode 100644
index 0000000..7db93f5
--- /dev/null
+++ b/Penguloon/Controls/Checkbox.cs
@@ -0,0 +1,44 @@
+using Microsoft.Xna.Framework;
+using Penguloon.Scenes;
+
+namespace Penguloon.Controls
+{
+ public class Checkbox : ControlBase
+ {
+ public bool Selected { get; set; } = false;
+
+ public Checkbox(SceneBase parentScene, Vector2 position, Vector2 size) : base(parentScene, position, size)
+ {
+ this.BackgroundIdle = ContentManager.GetTexture("UI/checkbox-empty");
+ this.BackgroundPressed = ContentManager.GetTexture("UI/checkbox-empty");
+ this.BackgroundDisabled = ContentManager.GetTexture("UI/checkbox-empty");
+
+ this.ForeColor = Color.White;
+ this.BorderColor = Color.Gray;
+ this.BorderWidth = 0;
+ this.Font = ContentManager.GetFont(StaticUIValues.MenuFont);
+
+ OnClick += Button_OnClick;
+ }
+
+ private void Button_OnClick(object sender, ClickArgs e)
+ {
+ Selected = !Selected;
+
+ if (Selected)
+ {
+ this.BackgroundIdle = ContentManager.GetTexture("UI/checkbox-selected");
+ this.BackgroundPressed = ContentManager.GetTexture("UI/checkbox-selected");
+ this.BackgroundDisabled = ContentManager.GetTexture("UI/checkbox-selected");
+ }
+ else
+ {
+ this.BackgroundIdle = ContentManager.GetTexture("UI/checkbox-empty");
+ this.BackgroundPressed = ContentManager.GetTexture("UI/checkbox-empty");
+ this.BackgroundDisabled = ContentManager.GetTexture("UI/checkbox-empty");
+ }
+
+ SoundManager.PlayClickSound();
+ }
+ }
+} \ No newline at end of file