Adding support for a rectangle class that uses floats instead of ints

master
nathan@daedalus 2012-03-23 22:19:58 -05:00
parent c11e02d10e
commit f4b91c0fc3
8 changed files with 90 additions and 5 deletions

View File

@ -179,6 +179,7 @@
<Compile Include="Engine\SimpleAxiosGameObject.cs" /> <Compile Include="Engine\SimpleAxiosGameObject.cs" />
<Compile Include="Engine\SimpleDrawableAxiosGameObject.cs" /> <Compile Include="Engine\SimpleDrawableAxiosGameObject.cs" />
<Compile Include="Engine\Singleton.cs" /> <Compile Include="Engine\Singleton.cs" />
<Compile Include="Engine\Structures\AxiosRectangle.cs" />
<Compile Include="Engine\UI\AxiosButton.cs" /> <Compile Include="Engine\UI\AxiosButton.cs" />
<Compile Include="Engine\UI\AxiosUIObject.cs" /> <Compile Include="Engine\UI\AxiosUIObject.cs" />
<Compile Include="Factories\BodyFactory.cs" /> <Compile Include="Factories\BodyFactory.cs" />

View File

@ -219,6 +219,7 @@
<Compile Include="Engine\Interfaces\IAxiosGameObject.cs" /> <Compile Include="Engine\Interfaces\IAxiosGameObject.cs" />
<Compile Include="Engine\Interfaces\IDrawableAxiosGameObject.cs" /> <Compile Include="Engine\Interfaces\IDrawableAxiosGameObject.cs" />
<Compile Include="Engine\Log\AxiosLog.cs" /> <Compile Include="Engine\Log\AxiosLog.cs" />
<Compile Include="Engine\Structures\AxiosRectangle.cs" />
<Compile Include="Engine\SimpleAxiosGameObject.cs" /> <Compile Include="Engine\SimpleAxiosGameObject.cs" />
<Compile Include="Engine\SimpleDrawableAxiosGameObject.cs" /> <Compile Include="Engine\SimpleDrawableAxiosGameObject.cs" />
<Compile Include="Engine\AxiosTimer.cs" /> <Compile Include="Engine\AxiosTimer.cs" />

View File

@ -172,6 +172,7 @@
<Compile Include="Engine\SimpleAxiosGameObject.cs" /> <Compile Include="Engine\SimpleAxiosGameObject.cs" />
<Compile Include="Engine\SimpleDrawableAxiosGameObject.cs" /> <Compile Include="Engine\SimpleDrawableAxiosGameObject.cs" />
<Compile Include="Engine\Singleton.cs" /> <Compile Include="Engine\Singleton.cs" />
<Compile Include="Engine\Structures\AxiosRectangle.cs" />
<Compile Include="Engine\UI\AxiosButton.cs" /> <Compile Include="Engine\UI\AxiosButton.cs" />
<Compile Include="Engine\UI\AxiosUIObject.cs" /> <Compile Include="Engine\UI\AxiosUIObject.cs" />
<Compile Include="Factories\BodyFactory.cs" /> <Compile Include="Factories\BodyFactory.cs" />

View File

@ -48,6 +48,8 @@
* - Adding field to allow/disallow automated mouse joints per object * - Adding field to allow/disallow automated mouse joints per object
* - Fixing bug with last screen not exiting if it is a background screen * - Fixing bug with last screen not exiting if it is a background screen
* *
* 1.0.1.1 - 3/22/2012
*
* *
*/ */

View File

@ -283,15 +283,15 @@ namespace Axios.Engine
Rectangle uirect; Rectangle uirect;
bool foundobject = false; bool foundobject = false;
Vector2 mousepos = ConvertUnits.ToSimUnits(input.Cursor); Vector2 mousepos = ConvertUnits.ToSimUnits(input.Cursor);
Vector2 objpos; //Vector2 objpos;
//System.Diagnostics.Debugger.Break(); //System.Diagnostics.Debugger.Break();
foreach(AxiosUIObject uiobject in _uiobjects) foreach(AxiosUIObject uiobject in _uiobjects)
{ {
uiobjpos = uiobject.Position; 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)) if (uirect.Contains((int)position.X, (int)position.Y))
{ {

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Axios.Engine.Structures
{
class AxiosPoint
{
}
}

View 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;
}
}
}

View File

@ -31,7 +31,7 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("1.0.0.9")] [assembly: AssemblyVersion("1.0.1.0")]
#if DEBUG #if DEBUG
[assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyConfiguration("Debug")]