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/Element.cs

44 lines
996 B
C#

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System;
namespace Galactic_Colors_Control_GUI.GUI
{
class Element
{
protected Rectangle _pos;
public bool _isHover;
public bool _isFocus;
public virtual bool Contain(int x, int y)
{
return _pos.Contains(x, y);
}
public virtual void Draw(SpriteBatch spriteBatch)
{
}
public virtual void Update(int x, int y, Mouse mouse, Keys key, bool isMaj, EventArgs e)
{
if (mouse.leftPress)
{
if (Contain(x, y))
{
_isFocus = true;
Click(this, e);
}
else { _isFocus = false; }
}
else { _isHover = Contain(x, y); }
}
public virtual void Click(object sender, EventArgs e)
{
}
}
}