* - Adding visible flag to DrawableAxiosGameObject

This commit is contained in:
Nathan Adams 2012-09-22 14:19:45 -05:00
parent 4c7c9e6d61
commit d73c59bcce
3 changed files with 25 additions and 11 deletions

View File

@ -115,6 +115,7 @@
* 1.0.1.7 - 7/22/2012 * 1.0.1.7 - 7/22/2012
* - Adding Factory for Texture2D to create from a list (ie lay a list of texture2D row by row) * - Adding Factory for Texture2D to create from a list (ie lay a list of texture2D row by row)
* - Adding AddScreen method to ScreenManager to make the PlayerIndex optional (default of PlayerIndex.One) * - Adding AddScreen method to ScreenManager to make the PlayerIndex optional (default of PlayerIndex.One)
* - Adding visible flag to DrawableAxiosGameObject
* *
*/ */
#endregion #endregion

View File

@ -217,8 +217,8 @@ namespace Axios.Engine
public override void Draw(GameTime gameTime) public override void Draw(GameTime gameTime)
{ {
//System.Diagnostics.Debugger.Break();
if (Level != null) if (Level != null)
{ {
foreach (Layer layer in Level.Layers) foreach (Layer layer in Level.Layers)

View File

@ -3,6 +3,7 @@ using Axios.Engine.Interfaces;
using FarseerPhysics.SamplesFramework; using FarseerPhysics.SamplesFramework;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using System.Diagnostics;
namespace Axios.Engine namespace Axios.Engine
{ {
@ -10,14 +11,22 @@ namespace Axios.Engine
{ {
protected int _draworder; protected int _draworder;
protected Texture2D Texture; protected Texture2D Texture;
protected bool _visible = true;
//public Vector2 Position = new Vector2(); //set this to a property and adjust if adjustunits is true //public Vector2 Position = new Vector2(); //set this to a property and adjust if adjustunits is true
public bool Visible
{
get { return _visible; }
set { this._visible = value; }
}
public Vector2 _position = Vector2.Zero; public Vector2 _position = Vector2.Zero;
public Vector2 Position public Vector2 Position
{ {
get get
{ {
//Debugger.Break();
return ConvertUnits.ToDisplayUnits(_position); return ConvertUnits.ToDisplayUnits(_position);
} }
set set
@ -78,16 +87,20 @@ namespace Axios.Engine
public virtual void Draw(AxiosGameScreen gameScreen, GameTime gameTime) public virtual void Draw(AxiosGameScreen gameScreen, GameTime gameTime)
{ {
//System.Diagnostics.Debugger.Break();
if (_relativetocamera) //Vector2 test = ConvertUnits.ToDisplayUnits(_position);
gameScreen.ScreenManager.SpriteBatch.Begin(0, null, null, null, null, null, gameScreen.Camera.View); if (_visible)
else {
gameScreen.ScreenManager.SpriteBatch.Begin(); if (_relativetocamera)
if (_adjustunits) gameScreen.ScreenManager.SpriteBatch.Begin(0, null, null, null, null, null, gameScreen.Camera.View);
gameScreen.ScreenManager.SpriteBatch.Draw(Texture, ConvertUnits.ToDisplayUnits(_position), null, Color.White, _rotation, Origin, _scale, SpriteEffects.None, 0); else
else gameScreen.ScreenManager.SpriteBatch.Begin();
gameScreen.ScreenManager.SpriteBatch.Draw(Texture, _position, null, Color.White, _rotation, Origin, _scale, SpriteEffects.None, 0); if (_adjustunits)
gameScreen.ScreenManager.SpriteBatch.End(); gameScreen.ScreenManager.SpriteBatch.Draw(Texture, ConvertUnits.ToDisplayUnits(_position), null, Color.White, _rotation, Origin, _scale, SpriteEffects.None, 0);
else
gameScreen.ScreenManager.SpriteBatch.Draw(Texture, _position, null, Color.White, _rotation, Origin, _scale, SpriteEffects.None, 0);
gameScreen.ScreenManager.SpriteBatch.End();
}
} }
public int DrawOrder public int DrawOrder