Adding support for a rectangle class that uses floats instead of ints
This commit is contained in:
parent
c11e02d10e
commit
f4b91c0fc3
@ -179,6 +179,7 @@
|
||||
<Compile Include="Engine\SimpleAxiosGameObject.cs" />
|
||||
<Compile Include="Engine\SimpleDrawableAxiosGameObject.cs" />
|
||||
<Compile Include="Engine\Singleton.cs" />
|
||||
<Compile Include="Engine\Structures\AxiosRectangle.cs" />
|
||||
<Compile Include="Engine\UI\AxiosButton.cs" />
|
||||
<Compile Include="Engine\UI\AxiosUIObject.cs" />
|
||||
<Compile Include="Factories\BodyFactory.cs" />
|
||||
|
@ -219,6 +219,7 @@
|
||||
<Compile Include="Engine\Interfaces\IAxiosGameObject.cs" />
|
||||
<Compile Include="Engine\Interfaces\IDrawableAxiosGameObject.cs" />
|
||||
<Compile Include="Engine\Log\AxiosLog.cs" />
|
||||
<Compile Include="Engine\Structures\AxiosRectangle.cs" />
|
||||
<Compile Include="Engine\SimpleAxiosGameObject.cs" />
|
||||
<Compile Include="Engine\SimpleDrawableAxiosGameObject.cs" />
|
||||
<Compile Include="Engine\AxiosTimer.cs" />
|
||||
|
@ -172,6 +172,7 @@
|
||||
<Compile Include="Engine\SimpleAxiosGameObject.cs" />
|
||||
<Compile Include="Engine\SimpleDrawableAxiosGameObject.cs" />
|
||||
<Compile Include="Engine\Singleton.cs" />
|
||||
<Compile Include="Engine\Structures\AxiosRectangle.cs" />
|
||||
<Compile Include="Engine\UI\AxiosButton.cs" />
|
||||
<Compile Include="Engine\UI\AxiosUIObject.cs" />
|
||||
<Compile Include="Factories\BodyFactory.cs" />
|
||||
|
@ -48,6 +48,8 @@
|
||||
* - Adding field to allow/disallow automated mouse joints per object
|
||||
* - Fixing bug with last screen not exiting if it is a background screen
|
||||
*
|
||||
* 1.0.1.1 - 3/22/2012
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -283,14 +283,14 @@ 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);
|
||||
//objpos = this.Camera.ConvertScreenToWorld(uiobjpos);
|
||||
|
||||
uirect = new Rectangle((int)uiobjpos.X, (int)uiobjpos.Y, (int)ConvertUnits.ToSimUnits(uiobject.Width), (int)ConvertUnits.ToSimUnits(uiobject.Height));
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -31,7 +31,7 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.9")]
|
||||
[assembly: AssemblyVersion("1.0.1.0")]
|
||||
|
||||
#if DEBUG
|
||||
[assembly: AssemblyConfiguration("Debug")]
|
||||
|
Loading…
Reference in New Issue
Block a user