From bee17a99afc32289f0c3061cc9cda72b59d2e2e3 Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Thu, 23 Jan 2020 11:40:32 -0500 Subject: [PATCH] create Debug.AddLine() function [currently does nothing] GitOrigin-RevId: c4f9afb4b06181ddff79c207a99bb6ba902e7ade --- Shared/Debug.cs | 18 ++++++++++++++++++ Shared/SneakGame.cs | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Shared/Debug.cs b/Shared/Debug.cs index b89c672..7fce50b 100644 --- a/Shared/Debug.cs +++ b/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 rects = new List(); + static List lines = new List(); 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; diff --git a/Shared/SneakGame.cs b/Shared/SneakGame.cs index 646b85b..325432d 100644 --- a/Shared/SneakGame.cs +++ b/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.