AngryTanks.Client.AnimatedSprite.Draw C# (CSharp) Method

Draw() public method

public Draw ( GameTime gameTime, SpriteBatch spriteBatch ) : void
gameTime Microsoft.Xna.Framework.GameTime
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch
return void
        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            if (!Running)
                return;

            Vector2 pixelPosition = World.WorldUnitsToPixels(Position);
            Vector2 pixelSize = World.WorldUnitsToPixels(Size);

            spriteBatch.Draw(Texture,
                             (Rectangle)new RectangleF(pixelPosition, pixelSize),
                             // for STRETCH MODE, set source relative to the texture's dimensions
                             new Rectangle(
                                 CurrentFrame.X * FrameSize.X,
                                 CurrentFrame.Y * FrameSize.Y,
                                 FrameSize.X, FrameSize.Y),
                             Color,
                             Rotation,
                             // for STRETCH MODE, set the origin relative to the texture's dimensions
                             new Vector2(FrameSize.X / 2, FrameSize.Y / 2),
                             SpriteEffects.None, 0);
        }
    }