Updating more code

--HG--
branch : axios-newgsm
This commit is contained in:
nathan@daedalus 2012-04-17 22:21:33 -05:00
parent 494a128094
commit 7cc7e9130c
9 changed files with 24 additions and 7 deletions

View File

@ -69,7 +69,7 @@ namespace Axios.Engine
this.ScaleChanged(gameObject); this.ScaleChanged(gameObject);
} }
private void OnEvent(AxiosHandler e, AxiosGameScreen gameScreen, InputHelper input) private void OnEvent(AxiosHandler e, AxiosGameScreen gameScreen, InputState input)
{ {
AxiosHandler handle = e; AxiosHandler handle = e;
if (handle != null) if (handle != null)

View File

@ -334,7 +334,7 @@ namespace Axios.Engine
} }
} }
public override void HandleInput(InputState input, GameTime gameTime) public override void HandleInput(GameTime gameTime, InputState input)
{ {
base.HandleInput(input, gameTime); base.HandleInput(input, gameTime);
@ -345,7 +345,7 @@ namespace Axios.Engine
g.HandleInput(this, input, gameTime); g.HandleInput(this, input, gameTime);
} }
public override void UnloadContent() public override void Deactivate()
{ {
base.UnloadContent(); base.UnloadContent();
//AxiosLog.Instance.AddLine("Memory usage before cleanup: " + GC.GetTotalMemory(true).ToString(), LoggingFlag.DEBUG); //AxiosLog.Instance.AddLine("Memory usage before cleanup: " + GC.GetTotalMemory(true).ToString(), LoggingFlag.DEBUG);

View File

@ -35,6 +35,7 @@ namespace GameStateManagement
/// </summary> /// </summary>
public abstract class GameScreen public abstract class GameScreen
{ {
protected bool HasCursor = false;
/// <summary> /// <summary>
/// Normally when one screen is brought up over the top of another, /// Normally when one screen is brought up over the top of another,
/// the first screen will transition off to make room for the new /// the first screen will transition off to make room for the new

View File

@ -146,6 +146,7 @@ namespace FarseerPhysics.SamplesFramework
public void LoadContent() public void LoadContent()
{ {
_cursorSprite = new Sprite(_manager.Content.Load<Texture2D>("Common/cursor")); _cursorSprite = new Sprite(_manager.Content.Load<Texture2D>("Common/cursor"));
#if WINDOWS_PHONE #if WINDOWS_PHONE
// virtual stick content // virtual stick content

View File

@ -62,8 +62,8 @@ namespace GameStateManagement
public override void HandleInput(GameTime gameTime, InputState input) public override void HandleInput(GameTime gameTime, InputState input)
{ {
//input. //input.
if (input.KeyboardState.GetPressedKeys().Length > 0 || if (input.CurrentKeyboardStates[0].GetPressedKeys().Length > 0 ||
input.GamePadState.IsButtonDown(Buttons.A | Buttons.Start | Buttons.Back) || input.CurrentGamePadStates[0].IsButtonDown(Buttons.A | Buttons.Start | Buttons.Back) ||
input.MouseState.LeftButton == ButtonState.Pressed) input.MouseState.LeftButton == ButtonState.Pressed)
{ {
_duration = TimeSpan.Zero; _duration = TimeSpan.Zero;

View File

@ -9,6 +9,7 @@
#region Using Statements #region Using Statements
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using GameStateManagementSample;
#endregion #endregion
namespace GameStateManagement namespace GameStateManagement

View File

@ -9,6 +9,7 @@
using System; using System;
using GameStateManagement; using GameStateManagement;
using GameStateManagementSample;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
namespace GameStateManagement namespace GameStateManagement

View File

@ -72,12 +72,13 @@ namespace GameStateManagement
{ {
if (!Axios.Settings.ScreenSaver) if (!Axios.Settings.ScreenSaver)
{ {
ContentManager man = new ContentManager(this.ScreenManager.Game.Services, "Content");
DebugView = new DebugViewXNA(World); DebugView = new DebugViewXNA(World);
DebugView.RemoveFlags(DebugViewFlags.Shape); DebugView.RemoveFlags(DebugViewFlags.Shape);
DebugView.RemoveFlags(DebugViewFlags.Joint); DebugView.RemoveFlags(DebugViewFlags.Joint);
DebugView.DefaultShapeColor = Color.White; DebugView.DefaultShapeColor = Color.White;
DebugView.SleepingShapeColor = Color.LightGray; DebugView.SleepingShapeColor = Color.LightGray;
DebugView.LoadContent(ScreenManager.GraphicsDevice, ScreenManager.Content); DebugView.LoadContent(ScreenManager.GraphicsDevice, man);
} }
} }

View File

@ -18,6 +18,7 @@ using Microsoft.Xna.Framework.Input.Touch;
using System.IO; using System.IO;
using System.IO.IsolatedStorage; using System.IO.IsolatedStorage;
using System.Xml.Linq; using System.Xml.Linq;
using FarseerPhysics.SamplesFramework;
#endregion #endregion
namespace GameStateManagement namespace GameStateManagement
@ -37,7 +38,7 @@ namespace GameStateManagement
List<GameScreen> screens = new List<GameScreen>(); List<GameScreen> screens = new List<GameScreen>();
List<GameScreen> tempScreensList = new List<GameScreen>(); List<GameScreen> tempScreensList = new List<GameScreen>();
InputState input = new InputState(); InputState input;
SpriteBatch spriteBatch; SpriteBatch spriteBatch;
SpriteFont font; SpriteFont font;
@ -47,11 +48,21 @@ namespace GameStateManagement
bool traceEnabled; bool traceEnabled;
/// <summary>
/// Contains all the fonts avaliable for use.
/// </summary>
private SpriteFonts _spriteFonts;
#endregion #endregion
#region Properties #region Properties
public SpriteFonts Fonts
{
get { return _spriteFonts; }
}
/// <summary> /// <summary>
/// A default SpriteBatch shared by all the screens. This saves /// A default SpriteBatch shared by all the screens. This saves
/// each screen having to bother creating their own local instance. /// each screen having to bother creating their own local instance.
@ -107,6 +118,7 @@ namespace GameStateManagement
// we must set EnabledGestures before we can query for them, but // we must set EnabledGestures before we can query for them, but
// we don't assume the game wants to read them. // we don't assume the game wants to read them.
TouchPanel.EnabledGestures = GestureType.None; TouchPanel.EnabledGestures = GestureType.None;
this.input = new InputState(this);
} }