The 2D layer · interface

SpriteBatch

One frame's worth of sprites.

Explained in Sprites and tilemaps.

interface SpriteBatch
import type { SpriteBatch } from '@driftengine/ui2d';

In depth

Fixed capacity, filled from the front, reset each frame. It grows for nobody: a batch that reallocated mid-frame would allocate in the hot path, and the failure it is protecting against — a caller drawing more than it planned for — is one that wants counting rather than absorbing.

Properties

NameTypeDescription
instancesreadonlyFloat32Arraycapacity * SPRITE_FLOATS, filled to count * SPRITE_FLOATS.
capacityreadonlynumber
countnumber
runsreadonlyInt32ArrayThree entries a run: texture, first instance, length.
runCountnumber
droppednumberSprites this frame refused for want of room. Zero is the only good value.