98 lines
2.6 KiB
C#
98 lines
2.6 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
|
|||
|
using Microsoft.Xna.Framework.Graphics;
|
|||
|
using FarseerPhysics.SamplesFramework;
|
|||
|
using FarseerPhysics.Factories;
|
|||
|
using FarseerPhysics.Dynamics;
|
|||
|
|
|||
|
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);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public override void OnMouseHover(AxiosGameScreen gameScreen, InputHelper input)
|
|||
|
{
|
|||
|
base.OnMouseHover(gameScreen, input);
|
|||
|
|
|||
|
this.Texture = _hovertexture;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public override void OnMouseLeave(AxiosGameScreen gameScreen, InputHelper input)
|
|||
|
{
|
|||
|
base.OnMouseLeave(gameScreen, input);
|
|||
|
|
|||
|
this.Texture = _normaltexture;
|
|||
|
}
|
|||
|
|
|||
|
public override void OnMouseDown(AxiosGameScreen gameScreen, InputHelper input)
|
|||
|
{
|
|||
|
base.OnMouseDown(gameScreen, input);
|
|||
|
|
|||
|
this.Texture = _clicktexture;
|
|||
|
}
|
|||
|
|
|||
|
public override void OnMouseUp(AxiosGameScreen gameScreen, InputHelper input)
|
|||
|
{
|
|||
|
base.OnMouseUp(gameScreen, input);
|
|||
|
|
|||
|
this.Texture = _hovertexture;
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
public override void HandleCursor(AxiosGameScreen gameScreen, InputHelper input)
|
|||
|
{
|
|||
|
base.HandleCursor(gameScreen, input);
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|