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

GitOrigin-RevId: c4f9afb4b06181ddff79c207a99bb6ba902e7ade
This commit is contained in:
Colin McMillen 2020-01-23 11:40:32 -05:00
parent 938a38bd77
commit bee17a99af
2 changed files with 19 additions and 1 deletions

View File

@ -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; public static bool Enabled;
static List<DebugRect> rects = new List<DebugRect>(); static List<DebugRect> rects = new List<DebugRect>();
static List<DebugLine> lines = new List<DebugLine>();
static Texture2D whiteTexture; static Texture2D whiteTexture;
static string toast = null; static string toast = null;
@ -38,12 +51,17 @@ namespace SemiColinGames {
public static void Clear() { public static void Clear() {
rects.Clear(); rects.Clear();
lines.Clear();
} }
public static void AddRect(Rectangle rect, Color color) { public static void AddRect(Rectangle rect, Color color) {
rects.Add(new DebugRect(rect, 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) { public static void DrawToast(SpriteBatch spriteBatch, SpriteFont font) {
if (toast == null) { if (toast == null) {
return; return;

View File

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