From f4b91c0fc31473a11e5e24d36e90f05b624672bb Mon Sep 17 00:00:00 2001 From: "nathan@daedalus" Date: Fri, 23 Mar 2012 22:19:58 -0500 Subject: [PATCH] Adding support for a rectangle class that uses floats instead of ints --- axios/Axios_WP7.csproj | 1 + axios/Axios_Windows.csproj | 1 + axios/Axios_Xbox_360.csproj | 1 + axios/Axios_settings.cs | 2 + axios/Engine/AxiosGameScreen.cs | 8 +-- axios/Engine/Structures/AxiosPoint.cs | 12 ++++ axios/Engine/Structures/AxiosRectangle.cs | 68 +++++++++++++++++++++++ axios/Properties/AssemblyInfo.cs | 2 +- 8 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 axios/Engine/Structures/AxiosPoint.cs create mode 100644 axios/Engine/Structures/AxiosRectangle.cs diff --git a/axios/Axios_WP7.csproj b/axios/Axios_WP7.csproj index c71e454..7ef7738 100644 --- a/axios/Axios_WP7.csproj +++ b/axios/Axios_WP7.csproj @@ -179,6 +179,7 @@ + diff --git a/axios/Axios_Windows.csproj b/axios/Axios_Windows.csproj index 3566e59..e401259 100644 --- a/axios/Axios_Windows.csproj +++ b/axios/Axios_Windows.csproj @@ -219,6 +219,7 @@ + diff --git a/axios/Axios_Xbox_360.csproj b/axios/Axios_Xbox_360.csproj index f549d30..f66b644 100644 --- a/axios/Axios_Xbox_360.csproj +++ b/axios/Axios_Xbox_360.csproj @@ -172,6 +172,7 @@ + diff --git a/axios/Axios_settings.cs b/axios/Axios_settings.cs index 47b9d2c..42f7211 100644 --- a/axios/Axios_settings.cs +++ b/axios/Axios_settings.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 + * * */ diff --git a/axios/Engine/AxiosGameScreen.cs b/axios/Engine/AxiosGameScreen.cs index 69d8f89..4b725be 100644 --- a/axios/Engine/AxiosGameScreen.cs +++ b/axios/Engine/AxiosGameScreen.cs @@ -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)) { diff --git a/axios/Engine/Structures/AxiosPoint.cs b/axios/Engine/Structures/AxiosPoint.cs new file mode 100644 index 0000000..9d40e39 --- /dev/null +++ b/axios/Engine/Structures/AxiosPoint.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Axios.Engine.Structures +{ + class AxiosPoint + { + + } +} diff --git a/axios/Engine/Structures/AxiosRectangle.cs b/axios/Engine/Structures/AxiosRectangle.cs new file mode 100644 index 0000000..c5fa2c7 --- /dev/null +++ b/axios/Engine/Structures/AxiosRectangle.cs @@ -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; + } + + + } +} diff --git a/axios/Properties/AssemblyInfo.cs b/axios/Properties/AssemblyInfo.cs index 849ebe0..6a35b32 100644 --- a/axios/Properties/AssemblyInfo.cs +++ b/axios/Properties/AssemblyInfo.cs @@ -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")]