33d46b0cd7
* Fixing rectangle placement in Farseer + * - Moving base.draw to last in AxiosGameScreen to make sure Farseer debug information is visible
37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using FarseerPhysics.Dynamics;
|
|
using FarseerPhysics.Common;
|
|
using FarseerPhysics.SamplesFramework;
|
|
using FarseerPhysics.Factories;
|
|
using Microsoft.Xna.Framework.Content;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using Microsoft.Xna.Framework;
|
|
|
|
namespace Axios.Engine.Gleed2D
|
|
{
|
|
public partial class RectangleItem : Item
|
|
{
|
|
public float Width;
|
|
public float Height;
|
|
public Color FillColor;
|
|
|
|
Body _body;
|
|
|
|
public RectangleItem()
|
|
{
|
|
}
|
|
|
|
public override void load(ContentManager cm, World world, ref Dictionary<string, Texture2D> cache)
|
|
{
|
|
base.load(cm, world, ref cache);
|
|
|
|
_body = BodyFactory.CreateRectangle(world, ConvertUnits.ToSimUnits(Width), ConvertUnits.ToSimUnits(Height), 1f);
|
|
_body.Position = ConvertUnits.ToSimUnits(Position) + new Vector2(ConvertUnits.ToSimUnits(Width)/2, ConvertUnits.ToSimUnits(Height)/2);
|
|
_body.UserData = this;
|
|
}
|
|
}
|
|
}
|