From 141a0660c40d11ba80394d52d52a0473c721ca90 Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Fri, 31 Jan 2020 14:12:02 -0500 Subject: [PATCH] Debug: draw lines correctly based on camera position. Make convenience function for calling AddLine() with Vectors. GitOrigin-RevId: 6ca9849f11a1db40cc7aeb3400e711d99f7946b3 --- Shared/Debug.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Shared/Debug.cs b/Shared/Debug.cs index 9927bc3..0155ca9 100644 --- a/Shared/Debug.cs +++ b/Shared/Debug.cs @@ -83,6 +83,10 @@ namespace SemiColinGames { lines.Add(new DebugLine(new Point(p1x, p1y), new Point(p2x, p2y), color)); } + public static void AddLine(Vector2 start, Vector2 end, Color color) { + lines.Add(new DebugLine(start.ToPoint(), end.ToPoint(), color)); + } + public static void DrawToasts(SpriteBatch spriteBatch, SpriteFont font) { if (!Enabled) { return; @@ -119,7 +123,7 @@ namespace SemiColinGames { Point[] points = Line.Rasterize(line.Start, line.End); foreach (var point in points) { spriteBatch.Draw( - whiteTexture, new Rectangle(point.X, point.Y, 1, 1), line.Color); + whiteTexture, new Rectangle(point.X - camera.Left, point.Y, 1, 1), line.Color); } } }