Browse Source

Debug: draw lines correctly based on camera position.

Make convenience function for calling AddLine() with Vectors.

GitOrigin-RevId: 6ca9849f11
master
Colin McMillen 4 years ago
parent
commit
141a0660c4
  1. 6
      Shared/Debug.cs

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

Loading…
Cancel
Save