SpriteBatcher Class

Batches sprite draw calls for efficient rendering. Sorts and groups sprites before submission to minimize state changes and draw calls.

public sealed class SpriteBatcher : System.IDisposable

Inheritance System.Object → SpriteBatcher

Implements System.IDisposable

Properties
Count Gets the current number of queued sprites.
EstimatedDrawCalls Gets the estimated number of draw calls issued in the last flush. This is an upper bound — layer, blend mode, or texture changes each count as a new draw call, even if the underlying renderer could coalesce them.
Methods
Clear() Clears all queued sprites without rendering.
Draw(ITexture, Vector2, Nullable<Rectangle>, Vector2, float, Vector2, Color, byte, SpriteFlip, BlendMode) Adds a sprite to the batch queue.
Flush(IDrawContext) Flushes all batched sprites to the renderer. Automatically sorts and groups sprites before submission to minimize state changes and draw calls. Sorts a lightweight index array rather than the full batch items to reduce swap cost.