AxiosEngine-old 

AxiosEngine-old Commit Details


Date:2012-03-23 23:54:00 (12 years 8 months ago)
Author:nathan@daedalus
Branch:default
Commit:6526c5e6050c
Parents: 1dffc3cc41e1
Message:Fixing issue with UI objects and collision with mouse pointer

Changes:
Maxios/Engine/AxiosGameScreen.cs (2 diffs)
Maxios/Engine/Structures/AxiosPoint.cs (1 diff)
Maxios/Engine/Structures/AxiosRectangle.cs (2 diffs)

File differences

axios/Engine/AxiosGameScreen.cs
2020
2121
2222
23
2324
2425
2526
......
280281
281282
282283
283
284
285
284286
285
287
286288
287289
290
288291
289292
290293
291294
292295
293
296
294297
295
298
296299
297300
298301
using Axios.Engine.Log;
using Axios.Engine.File;
using System.IO;
using Axios.Engine.Structures;
namespace Axios.Engine
{
}
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))
axios/Engine/Structures/AxiosPoint.cs
55
66
77
8
8
99
1010
1111
namespace Axios.Engine.Structures
{
class AxiosPoint
public class AxiosPoint
{
private float _x;
private float _y;
axios/Engine/Structures/AxiosRectangle.cs
55
66
77
8
8
99
1010
1111
......
7373
7474
7575
76
77
78
79
7680
7781
7882
namespace Axios.Engine.Structures
{
class AxiosRectangle
public class AxiosRectangle
{
private AxiosPoint _point;
_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);
}
}
}

Archive Download the corresponding diff file

Page rendered in 0.44555s using 13 queries.