move Debug.Enabled check into DrawToasts

GitOrigin-RevId: 8265b948f772443580166f89fc39d46735852da3
This commit is contained in:
Colin McMillen 2020-01-23 16:18:28 -05:00
parent e30aa75f80
commit 63aa190afe
2 changed files with 6 additions and 4 deletions

View File

@ -71,6 +71,9 @@ namespace SemiColinGames {
} }
public static void DrawToasts(SpriteBatch spriteBatch, SpriteFont font) { public static void DrawToasts(SpriteBatch spriteBatch, SpriteFont font) {
if (!Enabled) {
return;
}
int y = 10; int y = 10;
foreach (var toast in toasts) { foreach (var toast in toasts) {
spriteBatch.DrawString(font, toast, new Vector2(10, y), Color.Teal); spriteBatch.DrawString(font, toast, new Vector2(10, y), Color.Teal);
@ -103,7 +106,7 @@ namespace SemiColinGames {
Point[] points = Line.Rasterize(line.Start, line.End); Point[] points = Line.Rasterize(line.Start, line.End);
foreach (var point in points) { foreach (var point in points) {
spriteBatch.Draw( spriteBatch.Draw(
whiteTexture, new Rectangle(point.X, point.Y, 1, 1), line.Color); whiteTexture, new Rectangle(point.X, point.Y, 1, 1), line.Color);
} }
} }
} }

View File

@ -133,9 +133,8 @@ namespace SemiColinGames {
0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height); 0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
spriteBatch.Draw(renderTarget, drawRect, Color.White); spriteBatch.Draw(renderTarget, drawRect, Color.White);
if (Debug.Enabled) { // Draw debug toasts.
Debug.DrawToasts(spriteBatch, font); Debug.DrawToasts(spriteBatch, font);
}
spriteBatch.End(); spriteBatch.End();