Debug: draw lines correctly based on camera position.

Make convenience function for calling AddLine() with Vectors.

GitOrigin-RevId: 6ca9849f11a1db40cc7aeb3400e711d99f7946b3
This commit is contained in:
Colin McMillen 2020-01-31 14:12:02 -05:00
parent 1fd515070d
commit 141a0660c4

View File

@ -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);
}
}
}