* - 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
* - 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 visible flag to DrawableAxiosGameObject
*
*/
#endregion

View File

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

View File

@ -3,6 +3,7 @@ using Axios.Engine.Interfaces;
using FarseerPhysics.SamplesFramework;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.Diagnostics;
namespace Axios.Engine
{
@ -10,14 +11,22 @@ namespace Axios.Engine
{
protected int _draworder;
protected Texture2D Texture;
protected bool _visible = 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
{
get
{
//Debugger.Break();
return ConvertUnits.ToDisplayUnits(_position);
}
set
@ -78,16 +87,20 @@ namespace Axios.Engine
public virtual void Draw(AxiosGameScreen gameScreen, GameTime gameTime)
{
if (_relativetocamera)
gameScreen.ScreenManager.SpriteBatch.Begin(0, null, null, null, null, null, gameScreen.Camera.View);
else
gameScreen.ScreenManager.SpriteBatch.Begin();
if (_adjustunits)
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();
//System.Diagnostics.Debugger.Break();
//Vector2 test = ConvertUnits.ToDisplayUnits(_position);
if (_visible)
{
if (_relativetocamera)
gameScreen.ScreenManager.SpriteBatch.Begin(0, null, null, null, null, null, gameScreen.Camera.View);
else
gameScreen.ScreenManager.SpriteBatch.Begin();
if (_adjustunits)
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