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(); } } }