axiosengine/axios/Engine/Extensions/RectangleItemProperties.cs
Nathan Adams b6e6744a88 Adding extension for rectangleitem to get position in Farseer units ( getSimPosition )
Adding extension for vector2 to convert back and forth between sim and display units
2015-01-01 14:36:46 -06:00

22 lines
611 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Gleed2D.InGame;
using FarseerPhysics.SamplesFramework;
namespace Axios.Engine.Extensions
{
public static class AxiosExtensions_RectangleItemProperties
{
public static Vector2 getSimPosition(this RectangleItemProperties prop)
{
Vector2 pos = ConvertUnits.ToSimUnits(prop.Position);
pos.X += ConvertUnits.ToSimUnits(prop.Width / 2);
pos.Y += ConvertUnits.ToSimUnits(prop.Height / 2);
return pos;
}
}
}