From 33d46b0cd7ae7f7e4524445706deeaf315dc19d6 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Sun, 13 May 2012 22:20:50 -0500 Subject: [PATCH] + * - Fixing path placement in Farseer * Fixing rectangle placement in Farseer + * - Moving base.draw to last in AxiosGameScreen to make sure Farseer debug information is visible --- axios/Axios_settings.cs | 2 ++ axios/Engine/AxiosGameScreen.cs | 8 ++++---- axios/Engine/Gleed2D/PathItem.cs | 4 ++-- axios/Engine/Gleed2D/RectangleItem.cs | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/axios/Axios_settings.cs b/axios/Axios_settings.cs index 81e3a96..c016291 100644 --- a/axios/Axios_settings.cs +++ b/axios/Axios_settings.cs @@ -76,6 +76,8 @@ * - Adding support to load a Gleed2D level from a stream * - Adjusting units for Gleed2D position for Farseer bodies * - Modfying draw method in AxiosGameScreen to draw Gleed2D textures + * - Fixing path placement in Farseer + * - Moving base.draw to last in AxiosGameScreen to make sure Farseer debug information is visible * */ diff --git a/axios/Engine/AxiosGameScreen.cs b/axios/Engine/AxiosGameScreen.cs index 8cd820a..29e50c8 100644 --- a/axios/Engine/AxiosGameScreen.cs +++ b/axios/Engine/AxiosGameScreen.cs @@ -183,7 +183,7 @@ namespace Axios.Engine public override void Draw(GameTime gameTime) { - base.Draw(gameTime); + if (Level != null) { @@ -191,8 +191,8 @@ namespace Axios.Engine { Vector2 oldcameraposition = camera.Position; camera.Position *= layer.ScrollSpeed; - - ScreenManager.SpriteBatch.Begin(0, null, null, null, null, null, camera.matrix); + + ScreenManager.SpriteBatch.Begin(0, null, null, null, null, null, Camera.View); layer.draw(ScreenManager.SpriteBatch); ScreenManager.SpriteBatch.End(); @@ -206,7 +206,7 @@ namespace Axios.Engine foreach(AxiosUIObject g in (from x in _uiobjects orderby x.DrawOrder select x)) ((IDrawableAxiosGameObject)g).Draw(this, gameTime); - //System.Diagnostics.Debugger.Break(); + base.Draw(gameTime); //This is placed at the end so that Farseer debug information is visible } diff --git a/axios/Engine/Gleed2D/PathItem.cs b/axios/Engine/Gleed2D/PathItem.cs index 3af9567..c4dc9b9 100644 --- a/axios/Engine/Gleed2D/PathItem.cs +++ b/axios/Engine/Gleed2D/PathItem.cs @@ -30,8 +30,8 @@ namespace Axios.Engine.Gleed2D { base.load(cm, world, ref cache); - Vertices v = new Vertices(WorldPoints.Length); - foreach (Vector2 vec in WorldPoints) + Vertices v = new Vertices(LocalPoints.Length); + foreach (Vector2 vec in LocalPoints) v.Add(new Vector2(ConvertUnits.ToSimUnits(vec.X), ConvertUnits.ToSimUnits(vec.Y))); _body = BodyFactory.CreateLoopShape(world, v); diff --git a/axios/Engine/Gleed2D/RectangleItem.cs b/axios/Engine/Gleed2D/RectangleItem.cs index d455aad..d9ac2cf 100644 --- a/axios/Engine/Gleed2D/RectangleItem.cs +++ b/axios/Engine/Gleed2D/RectangleItem.cs @@ -28,8 +28,8 @@ namespace Axios.Engine.Gleed2D { base.load(cm, world, ref cache); - _body = BodyFactory.CreateRectangle(world, Width, Height, 1f); - _body.Position = ConvertUnits.ToSimUnits(Position); + _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; } }