The 2D layer · function
drawSprite
Push one quad. Allocates nothing.
Explained in Sprites and tilemaps.
function drawSprite(batch: SpriteBatch, texture: number, placement: SpritePlacement, source: UvRect | null, tint: ArrayLike<number> | null): voidimport { drawSprite } from '@driftengine/ui2d';Parameters
| Parameter | Type | Description |
|---|---|---|
batch | SpriteBatch | |
texture | number | |
placement | SpritePlacement | |
source | UvRect | null | |
tint | ArrayLike<number> | null |
In depth
source of null is the whole texture and tint of null is opaque white, because those are
what a caller drawing a plain image wants and neither should cost an object per draw.