Beispiel #1
0
 public override void DebugRender(Batcher batcher)
 {
     if (_cameraStyle == CameraStyle.LockOn)
     {
         batcher.DrawHollowRect(_worldSpaceDeadzone.X - 5, _worldSpaceDeadzone.Y - 5,
                                _worldSpaceDeadzone.Width, _worldSpaceDeadzone.Height, Color.DarkRed);
     }
     else
     {
         batcher.DrawHollowRect(_worldSpaceDeadzone, Color.DarkRed);
     }
 }
Beispiel #2
0
        public override void DebugRender(Batcher batcher)
        {
            var poly = Shape as Polygon;

            batcher.DrawHollowRect(Bounds, ECDebug.Colors.ColliderBounds, ECDebug.Size.LineSizeMultiplier);
            batcher.DrawPolygon(Shape.position, poly.Points, ECDebug.Colors.ColliderEdge, true,
                                ECDebug.Size.LineSizeMultiplier);
            batcher.DrawPixel(Entity.Transform.Position, ECDebug.Colors.ColliderPosition,
                              4 * ECDebug.Size.LineSizeMultiplier);
            batcher.DrawPixel(Shape.position, ECDebug.Colors.ColliderCenter, 2 * ECDebug.Size.LineSizeMultiplier);

            // Normal debug code
            //for( var i = 0; i < poly.points.Length; i++ )
            //{
            //	Vector2 p2;
            //	var p1 = poly.points[i];
            //	if( i + 1 >= poly.points.Length )
            //		p2 = poly.points[0];
            //	else
            //		p2 = poly.points[i + 1];
            //	var perp = Vector2Ext.perpendicular( ref p1, ref p2 );
            //	Vector2Ext.normalize( ref perp );
            //	var mp = Vector2.Lerp( p1, p2, 0.5f ) + poly.position;
            //	batcher.drawLine( mp, mp + perp * 10, Color.White );
            //}
        }
Beispiel #3
0
        public override void DebugRender(Batcher batcher)
        {
            for (var i = 0; i < _vertices.Length; i++)
            {
                var v = _vertices[i];
                batcher.DrawPixel(v.Position.X, v.Position.Y, Color.GhostWhite, 4);
            }

            batcher.DrawHollowRect(_bounds, ECDebug.Colors.ColliderBounds);
        }
Beispiel #4
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);
        }
Beispiel #5
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;
            }