Exemplo n.º 1
0
        public void Render(Batcher batcher, Vector2 offset)
        {
            var origin = new Vector2(0, Size.Y / (2 * _formatInstruction.Scale.Y));

            batcher.DrawString(_formatInstruction.Font, _text, offset + Position, _formatInstruction.Color, 0,
                               origin, _formatInstruction.Scale, SpriteEffects.None, 0);
        }
Exemplo n.º 2
0
 public static void DrawString(this Batcher batcher, NezSpriteFont spriteFont, string text, Vector2 position,
                               Color color, float rotation,
                               Vector2 origin, float scale, SpriteEffects effects, float layerDepth)
 {
     batcher.DrawString(spriteFont, text, position, color, rotation, origin, new Vector2(scale), effects,
                        layerDepth);
 }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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;
            }
Exemplo n.º 5
0
 public static void DrawString(this Batcher batcher, NezSpriteFont spriteFont, string text, Vector2 position,
                               Color color)
 {
     batcher.DrawString(spriteFont, text, position, color, 0.0f, Vector2.Zero, new Vector2(1.0f),
                        SpriteEffects.None, 0.0f);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Submit a text string of sprites for drawing in the current batch.
 /// </summary>
 /// <param name="batcher">Batcher.</param>
 /// <param name="font">Font.</param>
 /// <param name="text">Text.</param>
 /// <param name="position">Position.</param>
 /// <param name="color">Color.</param>
 public static void DrawString(this Batcher batcher, IFont font, StringBuilder text, Vector2 position,
                               Color color)
 {
     batcher.DrawString(font, text, position, color, 0.0f, Vector2.Zero, new Vector2(1.0f), SpriteEffects.None,
                        0.0f);
 }