Adding code for mouse handling

--HG--
branch : axios-newgsm
This commit is contained in:
nathan@daedalus
2012-04-17 22:07:51 -05:00
parent 2277056e6b
commit 494a128094
6 changed files with 125 additions and 20 deletions

View File

@@ -1,5 +1,6 @@
using System;
using FarseerPhysics.SamplesFramework;
using GameStateManagement;
namespace Axios.Engine
{
@@ -19,45 +20,45 @@ namespace Axios.Engine
}
}
public delegate void AxiosHandler(object sender, AxiosGameScreen gameScreen, InputHelper input);
public delegate void AxiosHandler(object sender, AxiosGameScreen gameScreen, InputState input);
public delegate void AxiosGameObjectHandler(AxiosGameObject sender);
#region GameObjectEventMethods
public virtual void OnFocusEnter(AxiosGameScreen gameScreen, InputHelper input)
public virtual void OnFocusEnter(AxiosGameScreen gameScreen, InputState input)
{
this.HasFocus = true;
this.OnEvent(FocusEnter, gameScreen, input);
}
public virtual void OnFocusLeave(AxiosGameScreen gameScreen, InputHelper input)
public virtual void OnFocusLeave(AxiosGameScreen gameScreen, InputState input)
{
this.HasFocus = false;
this.OnEvent(FocusLeave, gameScreen, input);
}
public virtual void OnMouseHover(AxiosGameScreen gameScreen, InputHelper input)
public virtual void OnMouseHover(AxiosGameScreen gameScreen, InputState input)
{
this.OnEvent(MouseHover, gameScreen, input);
}
public virtual void OnMouseLeave(AxiosGameScreen gameScreen, InputHelper input)
public virtual void OnMouseLeave(AxiosGameScreen gameScreen, InputState input)
{
this.OnEvent(MouseLeave, gameScreen, input);
}
public virtual void OnValueChange(AxiosGameScreen gameScreen, InputHelper input)
public virtual void OnValueChange(AxiosGameScreen gameScreen, InputState input)
{
this.OnEvent(ValueChange, gameScreen, input);
}
public virtual void OnMouseDown(AxiosGameScreen gameScreen, InputHelper input)
public virtual void OnMouseDown(AxiosGameScreen gameScreen, InputState input)
{
this.OnEvent(MouseDown, gameScreen, input);
}
public virtual void OnMouseUp(AxiosGameScreen gameScreen, InputHelper input)
public virtual void OnMouseUp(AxiosGameScreen gameScreen, InputState input)
{
this.OnEvent(MouseUp, gameScreen, input);
}

View File

@@ -334,7 +334,7 @@ namespace Axios.Engine
}
}
public override void HandleInput(InputHelper input, GameTime gameTime)
public override void HandleInput(InputState input, GameTime gameTime)
{
base.HandleInput(input, gameTime);

View File

@@ -2,6 +2,7 @@
using Axios.Engine.Interfaces;
using Microsoft.Xna.Framework;
using GameStateManagement;
namespace Axios.Engine
{
@@ -65,12 +66,12 @@ namespace Axios.Engine
}
public override void HandleInput(AxiosGameScreen gameScreen, FarseerPhysics.SamplesFramework.InputHelper input, Microsoft.Xna.Framework.GameTime gameTime)
public override void HandleInput(AxiosGameScreen gameScreen, InputState input, Microsoft.Xna.Framework.GameTime gameTime)
{
}
public override void HandleCursor(AxiosGameScreen gameScreen, FarseerPhysics.SamplesFramework.InputHelper input)
public override void HandleCursor(AxiosGameScreen gameScreen, InputState input)
{
}

View File

@@ -1,5 +1,6 @@
using FarseerPhysics.SamplesFramework;
using Microsoft.Xna.Framework;
using GameStateManagement;
namespace Axios.Engine.Interfaces
@@ -8,8 +9,8 @@ namespace Axios.Engine.Interfaces
{
void Update(AxiosGameScreen gameScreen, GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen);
void LoadContent(AxiosGameScreen gameScreen);
void HandleInput(AxiosGameScreen gameScreen, InputHelper input, GameTime gameTime);
void HandleCursor(AxiosGameScreen gameScreen, InputHelper input);
void HandleInput(AxiosGameScreen gameScreen, InputState input, GameTime gameTime);
void HandleCursor(AxiosGameScreen gameScreen, InputState input);
void UnloadContent(AxiosGameScreen gameScreen);
}
}

View File

@@ -1,6 +1,7 @@

using FarseerPhysics.SamplesFramework;
using Microsoft.Xna.Framework.Graphics;
using GameStateManagement;
namespace Axios.Engine.UI
{
@@ -48,7 +49,7 @@ namespace Axios.Engine.UI
}
public override void OnMouseHover(AxiosGameScreen gameScreen, InputHelper input)
public override void OnMouseHover(AxiosGameScreen gameScreen, InputState input)
{
base.OnMouseHover(gameScreen, input);
@@ -56,21 +57,21 @@ namespace Axios.Engine.UI
}
public override void OnMouseLeave(AxiosGameScreen gameScreen, InputHelper input)
public override void OnMouseLeave(AxiosGameScreen gameScreen, InputState input)
{
base.OnMouseLeave(gameScreen, input);
this.Texture = _normaltexture;
}
public override void OnMouseDown(AxiosGameScreen gameScreen, InputHelper input)
public override void OnMouseDown(AxiosGameScreen gameScreen, InputState input)
{
base.OnMouseDown(gameScreen, input);
this.Texture = _clicktexture;
}
public override void OnMouseUp(AxiosGameScreen gameScreen, InputHelper input)
public override void OnMouseUp(AxiosGameScreen gameScreen, InputState input)
{
base.OnMouseUp(gameScreen, input);
@@ -79,9 +80,9 @@ namespace Axios.Engine.UI
}
public override void HandleCursor(AxiosGameScreen gameScreen, InputHelper input)
public override void HandleCursor(AxiosGameScreen gameScreen, InputState input)
{
base.HandleCursor(gameScreen, input);