diff -r 1dffc3cc41e107996640e3064ed2d21516c35f0a -r 6526c5e6050c887509c1e8941aa6729987fe81be axios/Engine/AxiosGameScreen.cs --- a/axios/Engine/AxiosGameScreen.cs Fri Mar 23 23:21:26 2012 -0500 +++ b/axios/Engine/AxiosGameScreen.cs Fri Mar 23 23:54:58 2012 -0500 @@ -20,6 +20,7 @@ using Axios.Engine.Log; using Axios.Engine.File; using System.IO; +using Axios.Engine.Structures; namespace Axios.Engine { @@ -280,19 +281,21 @@ } Vector2 uiobjpos; - Rectangle uirect; + //Rectangle uirect; + AxiosRectangle uirect; bool foundobject = false; - Vector2 mousepos = ConvertUnits.ToSimUnits(input.Cursor); + Vector2 mousepos = this.Camera.ConvertScreenToWorld(input.Cursor); //Vector2 objpos; //System.Diagnostics.Debugger.Break(); + AxiosRectangle mousrect = new AxiosRectangle(mousepos.X, mousepos.Y, ConvertUnits.ToSimUnits(25), ConvertUnits.ToSimUnits(25)); foreach(AxiosUIObject uiobject in _uiobjects) { uiobjpos = uiobject.Position; //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)); + uirect = new AxiosRectangle(uiobjpos.X, uiobjpos.Y, ConvertUnits.ToSimUnits(uiobject.Width), ConvertUnits.ToSimUnits(uiobject.Height)); - if (uirect.Contains((int)position.X, (int)position.Y)) + if (uirect.Intersect(mousrect)) { if (input.IsNewMouseButtonPress(MouseButtons.LeftButton)) diff -r 1dffc3cc41e107996640e3064ed2d21516c35f0a -r 6526c5e6050c887509c1e8941aa6729987fe81be axios/Engine/Structures/AxiosPoint.cs --- a/axios/Engine/Structures/AxiosPoint.cs Fri Mar 23 23:21:26 2012 -0500 +++ b/axios/Engine/Structures/AxiosPoint.cs Fri Mar 23 23:54:58 2012 -0500 @@ -5,7 +5,7 @@ namespace Axios.Engine.Structures { - class AxiosPoint + public class AxiosPoint { private float _x; private float _y; diff -r 1dffc3cc41e107996640e3064ed2d21516c35f0a -r 6526c5e6050c887509c1e8941aa6729987fe81be axios/Engine/Structures/AxiosRectangle.cs --- a/axios/Engine/Structures/AxiosRectangle.cs Fri Mar 23 23:21:26 2012 -0500 +++ b/axios/Engine/Structures/AxiosRectangle.cs Fri Mar 23 23:54:58 2012 -0500 @@ -5,7 +5,7 @@ namespace Axios.Engine.Structures { - class AxiosRectangle + public class AxiosRectangle { private AxiosPoint _point; @@ -73,6 +73,10 @@ _point = new AxiosPoint(X, Y); } + public override string ToString() + { + return String.Format("{{X:{0} Y:{1} Width:{2} Height:{3}}}", _point.X, _point.Y, Width, Height); + } } }