43 lines
1.4 KiB
C#
43 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
|
|
namespace MrAG
|
|
{
|
|
public partial class Gui
|
|
{
|
|
public class CheckBox : Base
|
|
{
|
|
public bool Checked;
|
|
|
|
public Color CheckBorderColor = Color.Gray;
|
|
public Color CheckBackgroundColor = Color.Black;
|
|
public Color CheckCheckedColor = Color.DarkGray;
|
|
|
|
public int BorderSize = 2;
|
|
|
|
public Action OnCheckedChange;
|
|
|
|
public override void DoClick(int x, int y, MouseKey mouseKey)
|
|
{
|
|
this.Checked = !this.Checked;
|
|
|
|
if (this.OnCheckedChange != null)
|
|
this.OnCheckedChange.Invoke();
|
|
|
|
base.DoClick(x, y, mouseKey);
|
|
}
|
|
|
|
public override void Draw()
|
|
{
|
|
MrAG.Draw.Box(this.X + this.BorderSize, this.Y + this.BorderSize, this.Width - this.BorderSize - this.BorderSize, this.Height - this.BorderSize - this.BorderSize, this.Checked ? this.CheckCheckedColor : this.CheckBackgroundColor);
|
|
MrAG.Draw.OutlinedBox(this.X, this.Y, this.Width, this.Height, this.BorderSize, this.CheckBorderColor);
|
|
base.Draw();
|
|
}
|
|
}
|
|
}
|
|
}
|