Adding support for a rectangle class that uses floats instead of ints
This commit is contained in:
@@ -283,15 +283,15 @@ namespace Axios.Engine
|
||||
Rectangle uirect;
|
||||
bool foundobject = false;
|
||||
Vector2 mousepos = ConvertUnits.ToSimUnits(input.Cursor);
|
||||
Vector2 objpos;
|
||||
//Vector2 objpos;
|
||||
//System.Diagnostics.Debugger.Break();
|
||||
foreach(AxiosUIObject uiobject in _uiobjects)
|
||||
{
|
||||
uiobjpos = uiobject.Position;
|
||||
objpos = this.Camera.ConvertScreenToWorld(uiobjpos);
|
||||
|
||||
uirect = new Rectangle((int)uiobjpos.X, (int)uiobjpos.Y, (int)ConvertUnits.ToSimUnits(uiobject.Width), (int)ConvertUnits.ToSimUnits(uiobject.Height));
|
||||
//objpos = this.Camera.ConvertScreenToWorld(uiobjpos);
|
||||
|
||||
uirect = new Rectangle((int)uiobjpos.X, (int)uiobjpos.Y, (int)Math.Ceiling(ConvertUnits.ToSimUnits(uiobject.Width)), (int)Math.Ceiling(ConvertUnits.ToSimUnits(uiobject.Height) + 1));
|
||||
|
||||
if (uirect.Contains((int)position.X, (int)position.Y))
|
||||
{
|
||||
|
||||
|
12
axios/Engine/Structures/AxiosPoint.cs
Normal file
12
axios/Engine/Structures/AxiosPoint.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Axios.Engine.Structures
|
||||
{
|
||||
class AxiosPoint
|
||||
{
|
||||
|
||||
}
|
||||
}
|
68
axios/Engine/Structures/AxiosRectangle.cs
Normal file
68
axios/Engine/Structures/AxiosRectangle.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Axios.Engine.Structures
|
||||
{
|
||||
class AxiosRectangle
|
||||
{
|
||||
private float _width;
|
||||
private float _height;
|
||||
private float _x;
|
||||
private float _y;
|
||||
|
||||
public float Width
|
||||
{
|
||||
get { return _width; }
|
||||
set { _width = value; }
|
||||
}
|
||||
|
||||
public float Height
|
||||
{
|
||||
get { return _height; }
|
||||
set { _height = value; }
|
||||
}
|
||||
|
||||
public float X
|
||||
{
|
||||
get { return _x; }
|
||||
set { _x = value; }
|
||||
}
|
||||
|
||||
public float Y
|
||||
{
|
||||
get { return _y; }
|
||||
set { _y = value; }
|
||||
}
|
||||
|
||||
public float Top
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public float Bottom
|
||||
{
|
||||
get { return _y + _height; }
|
||||
}
|
||||
|
||||
public bool Intersect(AxiosRectangle rect)
|
||||
{
|
||||
bool intersects = false;
|
||||
|
||||
|
||||
|
||||
return intersects;
|
||||
}
|
||||
|
||||
public AxiosRectangle(float X, float Y, float width, float height)
|
||||
{
|
||||
_width = width;
|
||||
_height = height;
|
||||
_x = X;
|
||||
_y = Y;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user