+ Fixing UI detect bug
+ Adding Width/Height/Position/RealPosition to DrawableAxiosGameObject
This commit is contained in:
parent
db369a362d
commit
7a99ff254f
@ -105,6 +105,8 @@
|
|||||||
* be overwritten in each screen
|
* be overwritten in each screen
|
||||||
* - Adding output to tcc console command to signal if it was disabled/enabled
|
* - Adding output to tcc console command to signal if it was disabled/enabled
|
||||||
* - Adding DegreeToRadian/RadianToDegree double extensions
|
* - Adding DegreeToRadian/RadianToDegree double extensions
|
||||||
|
* - Fixing UI detect bug
|
||||||
|
* - Adding Width/Height/Position/RealPosition to DrawableAxiosGameObject
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -340,7 +340,7 @@ namespace Axios.Engine
|
|||||||
uiobjpos = uiobject.Position;
|
uiobjpos = uiobject.Position;
|
||||||
//objpos = this.Camera.ConvertScreenToWorld(uiobjpos);
|
//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))
|
if (uirect.Intersect(mousrect))
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,28 @@ namespace Axios.Engine
|
|||||||
{
|
{
|
||||||
protected int _draworder;
|
protected int _draworder;
|
||||||
protected Texture2D Texture;
|
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();
|
public Vector2 Origin = new Vector2();
|
||||||
|
|
||||||
protected bool _adjustunits = true;
|
protected bool _adjustunits = true;
|
||||||
@ -36,6 +57,18 @@ namespace Axios.Engine
|
|||||||
set { _relativetocamera = value; }
|
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)
|
public override void LoadContent(AxiosGameScreen gameScreen)
|
||||||
{
|
{
|
||||||
base.LoadContent(gameScreen);
|
base.LoadContent(gameScreen);
|
||||||
@ -51,9 +84,9 @@ namespace Axios.Engine
|
|||||||
else
|
else
|
||||||
gameScreen.ScreenManager.SpriteBatch.Begin();
|
gameScreen.ScreenManager.SpriteBatch.Begin();
|
||||||
if (_adjustunits)
|
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
|
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();
|
gameScreen.ScreenManager.SpriteBatch.End();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,17 +4,7 @@ namespace Axios.Engine.UI
|
|||||||
{
|
{
|
||||||
public class AxiosUIObject : DrawableAxiosGameObject
|
public class AxiosUIObject : DrawableAxiosGameObject
|
||||||
{
|
{
|
||||||
public int Width
|
|
||||||
{
|
|
||||||
get { return this.Texture.Width; }
|
|
||||||
private set { }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Height
|
|
||||||
{
|
|
||||||
get { return this.Texture.Height; }
|
|
||||||
private set {}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user