diff --git a/axios/Axios_settings.cs b/axios/Axios_settings.cs index d4865e6..5affa94 100644 --- a/axios/Axios_settings.cs +++ b/axios/Axios_settings.cs @@ -105,6 +105,8 @@ * be overwritten in each screen * - Adding output to tcc console command to signal if it was disabled/enabled * - Adding DegreeToRadian/RadianToDegree double extensions + * - Fixing UI detect bug + * - Adding Width/Height/Position/RealPosition to DrawableAxiosGameObject * * */ diff --git a/axios/Engine/AxiosGameScreen.cs b/axios/Engine/AxiosGameScreen.cs index 2b1c393..5096089 100644 --- a/axios/Engine/AxiosGameScreen.cs +++ b/axios/Engine/AxiosGameScreen.cs @@ -340,7 +340,7 @@ namespace Axios.Engine uiobjpos = uiobject.Position; //objpos = this.Camera.ConvertScreenToWorld(uiobjpos); - uirect = new AxiosRectangle(uiobjpos.X, uiobjpos.Y, ConvertUnits.ToSimUnits(uiobject.Width), ConvertUnits.ToSimUnits(uiobject.Height)); + uirect = new AxiosRectangle(ConvertUnits.ToSimUnits(uiobjpos.X), ConvertUnits.ToSimUnits(uiobjpos.Y), ConvertUnits.ToSimUnits(uiobject.Width), ConvertUnits.ToSimUnits(uiobject.Height)); if (uirect.Intersect(mousrect)) { diff --git a/axios/Engine/DrawableAxiosGameObject.cs b/axios/Engine/DrawableAxiosGameObject.cs index cdfc706..d1288cd 100644 --- a/axios/Engine/DrawableAxiosGameObject.cs +++ b/axios/Engine/DrawableAxiosGameObject.cs @@ -10,7 +10,28 @@ namespace Axios.Engine { protected int _draworder; protected Texture2D Texture; - 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 Vector2 _position = Vector2.Zero; + public Vector2 Position + { + get + { + return ConvertUnits.ToDisplayUnits(_position); + } + set + { + _position = value; + } + } + + public Vector2 RealPosition + { + get { return _position; } + private set { } + } + public Vector2 Origin = new Vector2(); protected bool _adjustunits = true; @@ -36,6 +57,18 @@ namespace Axios.Engine set { _relativetocamera = value; } } + public int Width + { + get { return this.Texture.Width; } + private set { } + } + + public int Height + { + get { return this.Texture.Height; } + private set { } + } + public override void LoadContent(AxiosGameScreen gameScreen) { base.LoadContent(gameScreen); @@ -51,9 +84,9 @@ namespace Axios.Engine else gameScreen.ScreenManager.SpriteBatch.Begin(); if (_adjustunits) - gameScreen.ScreenManager.SpriteBatch.Draw(Texture, ConvertUnits.ToDisplayUnits(Position), null, Color.White, _rotation, Origin, _scale, SpriteEffects.None, 0); + 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.Draw(Texture, _position, null, Color.White, _rotation, Origin, _scale, SpriteEffects.None, 0); gameScreen.ScreenManager.SpriteBatch.End(); } diff --git a/axios/Engine/UI/AxiosUIObject.cs b/axios/Engine/UI/AxiosUIObject.cs index 9cda7ef..35c1361 100644 --- a/axios/Engine/UI/AxiosUIObject.cs +++ b/axios/Engine/UI/AxiosUIObject.cs @@ -4,17 +4,7 @@ namespace Axios.Engine.UI { public class AxiosUIObject : DrawableAxiosGameObject { - public int Width - { - get { return this.Texture.Width; } - private set { } - } - public int Height - { - get { return this.Texture.Height; } - private set {} - } } }