From 2cb22a74aed80e2cce68f16b0821a690c7c05b7a Mon Sep 17 00:00:00 2001 From: aldrikboy Date: Thu, 18 Jan 2018 11:04:53 +0100 Subject: new levels, auto round start --- Penguloon/Controls/Checkbox.cs | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Penguloon/Controls/Checkbox.cs (limited to 'Penguloon/Controls/Checkbox.cs') 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 -- cgit v1.2.3-70-g09d2