2012-03-24 23:06:51 +00:00
|
|
|
|
|
2012-03-19 23:57:59 +00:00
|
|
|
|
using FarseerPhysics.SamplesFramework;
|
2012-03-24 23:06:51 +00:00
|
|
|
|
using Microsoft.Xna.Framework.Graphics;
|
2012-04-18 03:07:51 +00:00
|
|
|
|
using GameStateManagement;
|
2012-03-19 23:57:59 +00:00
|
|
|
|
|
|
|
|
|
namespace Axios.Engine.UI
|
|
|
|
|
{
|
|
|
|
|
public class AxiosButton : AxiosUIObject
|
|
|
|
|
{
|
|
|
|
|
protected Texture2D _hovertexture;
|
|
|
|
|
protected Texture2D _clicktexture;
|
|
|
|
|
protected Texture2D _normaltexture;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// HoverTexture is the texture that will be set when the mouse hovers over the button
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Texture2D HoverTexture
|
|
|
|
|
{
|
|
|
|
|
get { return this._hovertexture; }
|
|
|
|
|
set { this._hovertexture = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The ClickTexture is the texture that will be set when the user clicks on the button
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Texture2D ClickTexture
|
|
|
|
|
{
|
|
|
|
|
get { return this._clicktexture; }
|
|
|
|
|
set { this._clicktexture = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The normal texture is the texture when the button is not active
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Texture2D NormalTexture
|
|
|
|
|
{
|
|
|
|
|
get { return this._normaltexture; }
|
|
|
|
|
set { this._normaltexture = value; this.Texture = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public AxiosButton()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void LoadContent(AxiosGameScreen gameScreen)
|
|
|
|
|
{
|
|
|
|
|
base.LoadContent(gameScreen);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-18 03:07:51 +00:00
|
|
|
|
public override void OnMouseHover(AxiosGameScreen gameScreen, InputState input)
|
2012-03-19 23:57:59 +00:00
|
|
|
|
{
|
|
|
|
|
base.OnMouseHover(gameScreen, input);
|
|
|
|
|
|
|
|
|
|
this.Texture = _hovertexture;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-18 03:07:51 +00:00
|
|
|
|
public override void OnMouseLeave(AxiosGameScreen gameScreen, InputState input)
|
2012-03-19 23:57:59 +00:00
|
|
|
|
{
|
|
|
|
|
base.OnMouseLeave(gameScreen, input);
|
|
|
|
|
|
|
|
|
|
this.Texture = _normaltexture;
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-18 03:07:51 +00:00
|
|
|
|
public override void OnMouseDown(AxiosGameScreen gameScreen, InputState input)
|
2012-03-19 23:57:59 +00:00
|
|
|
|
{
|
|
|
|
|
base.OnMouseDown(gameScreen, input);
|
|
|
|
|
|
|
|
|
|
this.Texture = _clicktexture;
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-18 03:07:51 +00:00
|
|
|
|
public override void OnMouseUp(AxiosGameScreen gameScreen, InputState input)
|
2012-03-19 23:57:59 +00:00
|
|
|
|
{
|
|
|
|
|
base.OnMouseUp(gameScreen, input);
|
|
|
|
|
|
|
|
|
|
this.Texture = _hovertexture;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2012-04-18 03:07:51 +00:00
|
|
|
|
|
|
|
|
|
public override void HandleCursor(AxiosGameScreen gameScreen, InputState input)
|
2012-03-19 23:57:59 +00:00
|
|
|
|
{
|
|
|
|
|
base.HandleCursor(gameScreen, input);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|