Merge with axios-newgsm

This commit is contained in:
nathan@daedalus
2012-04-28 22:04:40 -05:00
35 changed files with 3361 additions and 624 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);
}
@@ -68,7 +69,7 @@ namespace Axios.Engine
this.ScaleChanged(gameObject);
}
private void OnEvent(AxiosHandler e, AxiosGameScreen gameScreen, InputHelper input)
private void OnEvent(AxiosHandler e, AxiosGameScreen gameScreen, InputState input)
{
AxiosHandler handle = e;
if (handle != null)

View File

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

View File

@@ -8,7 +8,9 @@ using Axios.Engine.UI;
using FarseerPhysics.Dynamics;
using FarseerPhysics.SamplesFramework;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using GameStateManagement;
namespace Axios.Engine
{
@@ -158,19 +160,16 @@ namespace Axios.Engine
AxiosLog.Instance.AddLine("Memory usage after cleanup: ", LoggingFlag.DEBUG);
}
public override void ExitScreen()
public override void Activate(bool instancePreserved)
{
base.ExitScreen();
}
public override void LoadContent()
{
base.LoadContent();
base.Activate(instancePreserved);
#if DEBUG
if (!Axios.Settings.ScreenSaver)
this.DebugSpriteFont = this.ScreenManager.Content.Load<SpriteFont>(this.DebugTextFont);
{
ContentManager man = new ContentManager(ScreenManager.Game.Services, "Content");
this.DebugSpriteFont = man.Load<SpriteFont>(this.DebugTextFont);
}
#endif
}
@@ -211,7 +210,7 @@ namespace Axios.Engine
}
public override void HandleCursor(InputHelper input)
public override void HandleCursor(InputState input)
{
base.HandleCursor(input);
HandleMouseEvents(input);
@@ -220,7 +219,7 @@ namespace Axios.Engine
g.HandleCursor(this, input);
}
private void HandleMouseEvents(InputHelper input)
private void HandleMouseEvents(InputState input)
{
Vector2 position = this.Camera.ConvertScreenToWorld(input.Cursor);
Fixture fix = this.World.TestPoint(position);
@@ -335,9 +334,9 @@ namespace Axios.Engine
}
}
public override void HandleInput(InputHelper input, GameTime gameTime)
public override void HandleInput(GameTime gameTime, InputState input)
{
base.HandleInput(input, gameTime);
base.HandleInput(gameTime, input);
foreach (AxiosGameObject g in _gameObjects.ToList())
g.HandleInput(this, input, gameTime);
@@ -346,9 +345,9 @@ namespace Axios.Engine
g.HandleInput(this, input, gameTime);
}
public override void UnloadContent()
public override void Deactivate()
{
base.UnloadContent();
base.Deactivate();
//AxiosLog.Instance.AddLine("Memory usage before cleanup: " + GC.GetTotalMemory(true).ToString(), LoggingFlag.DEBUG);
foreach (AxiosGameObject g in _gameObjects)
g.UnloadContent(this);

View File

@@ -2,6 +2,7 @@
using Axios.Engine.Interfaces;
using Microsoft.Xna.Framework;
using GameStateManagement;
namespace Axios.Engine
{
@@ -66,12 +67,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);