Browse Source

create Debug.AddLine() function [currently does nothing]

GitOrigin-RevId: c4f9afb4b0
master
Colin McMillen 4 years ago
parent
commit
bee17a99af
  1. 18
      Shared/Debug.cs
  2. 2
      Shared/SneakGame.cs

18
Shared/Debug.cs

@ -14,8 +14,21 @@ namespace SemiColinGames {
}
}
struct DebugLine {
public Point start;
public Point end;
public Color color;
public DebugLine(Point start, Point end, Color color) {
this.start = start;
this.end = end;
this.color = color;
}
}
public static bool Enabled;
static List<DebugRect> rects = new List<DebugRect>();
static List<DebugLine> lines = new List<DebugLine>();
static Texture2D whiteTexture;
static string toast = null;
@ -38,12 +51,17 @@ namespace SemiColinGames {
public static void Clear() {
rects.Clear();
lines.Clear();
}
public static void AddRect(Rectangle rect, Color color) {
rects.Add(new DebugRect(rect, color));
}
public static void AddLine(Point start, Point end, Color color) {
lines.Add(new DebugLine(start, end, color));
}
public static void DrawToast(SpriteBatch spriteBatch, SpriteFont font) {
if (toast == null) {
return;

2
Shared/SneakGame.cs

@ -114,7 +114,7 @@ namespace SemiColinGames {
// Draw foreground tiles.
world.Draw(spriteBatch, camera);
// Draw debug rects.
// Draw debug rects & lines.
Debug.Draw(spriteBatch, camera);
// Aaaaand we're done.

Loading…
Cancel
Save