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): void
import { drawSprite } from '@driftengine/ui2d';

Parameters

ParameterTypeDescription
batchSpriteBatch
texturenumber
placementSpritePlacement
sourceUvRect | null
tintArrayLike<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.