public static void DrawHollowRect(this Batcher batcher, float x, float y, float width, float height, Color color, float thickness = 1) { var tl = new Vector2(x, y); var tr = new Vector2(x + width, y); var br = new Vector2(x + width, y + height); var bl = new Vector2(x, y + height); #if MG38 tl.Round(); tr.Round(); br.Round(); bl.Round(); #else tl = tl.Round(); tr = tr.Round(); br = br.Round(); bl = bl.Round(); #endif batcher.SetIgnoreRoundingDestinations(true); batcher.DrawLine(tl, tr, color, thickness); batcher.DrawLine(tr, br, color, thickness); batcher.DrawLine(br, bl, color, thickness); batcher.DrawLine(bl, tl, color, thickness); batcher.SetIgnoreRoundingDestinations(false); }
public static void DrawHollowRect(this Batcher batcher, float x, float y, float width, float height, Color color, float thickness = 1) { var tl = Vector2Ext.Round(new Vector2(x, y)); var tr = Vector2Ext.Round(new Vector2(x + width, y)); var br = Vector2Ext.Round(new Vector2(x + width, y + height)); var bl = Vector2Ext.Round(new Vector2(x, y + height)); batcher.SetIgnoreRoundingDestinations(true); batcher.DrawLine(tl, tr, color, thickness); batcher.DrawLine(tr, br, color, thickness); batcher.DrawLine(br, bl, color, thickness); batcher.DrawLine(bl, tl, color, thickness); batcher.SetIgnoreRoundingDestinations(false); }
/// <summary> /// returns true if we are done with this debug draw item /// </summary> public bool Draw(Batcher batcher) { switch (drawType) { case DebugDrawType.Line: batcher.DrawLine(Start, End, Color); break; case DebugDrawType.HollowRectangle: batcher.DrawHollowRect(Rectangle, Color); break; case DebugDrawType.Pixel: batcher.DrawPixel(X, Y, Color, Size); break; case DebugDrawType.BitmapFontText: batcher.DrawString(BitmapFont, Text, Position, Color, 0f, Vector2.Zero, Scale, SpriteEffects.None, 0f); break; case DebugDrawType.SpriteFontText: batcher.DrawString(SpriteFont, Text, Position, Color, 0f, Vector2.Zero, new Vector2(Scale), SpriteEffects.None, 0f); break; case DebugDrawType.ConsoleText: batcher.DrawString(BitmapFont, Text, Position, Color, 0f, Vector2.Zero, Scale, SpriteEffects.None, 0f); break; case DebugDrawType.Circle: batcher.DrawCircle(X, Y, Radius, Color); break; } Duration -= Time.DeltaTime; return(Duration < 0f); }