The 2D layer · interface
SpriteBatch
One frame's worth of sprites.
Explained in Sprites and tilemaps.
interface SpriteBatchimport 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
| Name | Type | Description |
|---|---|---|
instancesreadonly | Float32Array | capacity * SPRITE_FLOATS, filled to count * SPRITE_FLOATS. |
capacityreadonly | number | |
count | number | |
runsreadonly | Int32Array | Three entries a run: texture, first instance, length. |
runCount | number | |
dropped | number | Sprites this frame refused for want of room. Zero is the only good value. |