Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        /// <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;
            }

            Duration -= Time.DeltaTime;

            return(Duration < 0f);
        }
Esempio n. 3
0
            internal static void Flush(Batcher batcher)
            {
                for (int i = 0; i < DeferredCount; i++)
                {
                    var evt = DeferredEvents[i];
                    switch (evt.Type)
                    {
                    case 1:
                        batcher.DrawString(Theme.DeveloperFont, evt.Message, evt.Position, evt.Color);
                        break;

                    case 2:
                        batcher.DrawRect(evt.Rect, evt.Color);
                        break;

                    case 3:
                        batcher.DrawHollowRect(evt.Rect, evt.Color, evt.Size);
                        break;

                    case 4:
                        batcher.DrawPixel(evt.Position, evt.Color, evt.Size);
                        break;

                    case 5:
                        batcher.DrawCircle(evt.Position, evt.Radius, evt.Color, evt.Size);
                        break;

                    case 6:
                        batcher.DrawLine(evt.Position, evt.End, evt.Color, evt.Size);
                        break;
                    }
                }
                stringSplat.X = messagePadding;
                stringSplat.Y = messagePadding;
                DeferredCount = 0;
            }