SDK/MrAG/Gui/ProgressBar.cs

37 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 ProgressBar : Base {
public Color BackColor = Color.Black;
public Color FrontColor = Color.Gray;
public Color BorderColor = Color.DarkOrchid;
public int BorderSize = 2;
public int _value;
public int Value {
get { return this._value; }
set{
if (value <= this.MaxValue && value >= 0)
this._value = value;
}
}
public int MaxValue = 100;
public override void Draw() {
MrAG.Draw.Box(this.X + this.BorderSize, this.Y + this.BorderSize, this.Width - (this.BorderSize * 2), this.Height - (this.BorderSize * 2), this.BackColor);
MrAG.Draw.Box(this.X + this.BorderSize, this.Y + this.BorderSize, (int)(((double)this.Value / (double)this.MaxValue) * (this.Width - (this.BorderSize * 2))), this.Height - (this.BorderSize * 2), this.FrontColor);
MrAG.Draw.OutlinedBox(this.X, this.Y, this.Width, this.Height, this.BorderSize, this.BorderColor);
base.Draw();
}
}
}
}