From d73c59bcce44718a70f41e10e0eb130fb09b0e7d Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Sat, 22 Sep 2012 14:19:45 -0500 Subject: [PATCH] * - Adding visible flag to DrawableAxiosGameObject --- axios/Axios_settings.cs | 1 + axios/Engine/AxiosGameScreen.cs | 2 +- axios/Engine/DrawableAxiosGameObject.cs | 33 +++++++++++++++++-------- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/axios/Axios_settings.cs b/axios/Axios_settings.cs index 86b7c99..a9d08d8 100644 --- a/axios/Axios_settings.cs +++ b/axios/Axios_settings.cs @@ -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 diff --git a/axios/Engine/AxiosGameScreen.cs b/axios/Engine/AxiosGameScreen.cs index c564034..0dce8cb 100644 --- a/axios/Engine/AxiosGameScreen.cs +++ b/axios/Engine/AxiosGameScreen.cs @@ -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) diff --git a/axios/Engine/DrawableAxiosGameObject.cs b/axios/Engine/DrawableAxiosGameObject.cs index d1288cd..70d2438 100644 --- a/axios/Engine/DrawableAxiosGameObject.cs +++ b/axios/Engine/DrawableAxiosGameObject.cs @@ -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