1
0
Fork 0
This repository has been archived on 2019-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
Galactic_Colors_Control/Galactic Colors Control GUI/GUI/Button.cs

43 lines
961 B
C#

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
namespace Galactic_Colors_Control_GUI.GUI
{
class Button : Element
{
protected event EventHandler _click;
protected int _unFocusTime = 0;
public Button() { }
public Button(Rectangle pos, EventHandler click = null)
{
_pos = pos;
_click = click;
}
public override void Click(object sender, EventArgs e)
{
if (_click != null)
{
_click.Invoke(sender, e);
}
}
public override void Draw(SpriteBatch spriteBatch)
{
if (_isFocus) {
if (_unFocusTime < 10)
{
_unFocusTime++;
}
else {
_isFocus = false;
_unFocusTime = 0;
}
}
}
}
}