Documentation / spryte / createRenderer
Function: createRenderer()
createRenderer(
canvas,options?):Draw
Defined in: renderer.ts:20
A Draw for a canvas: WebGL2 when available, otherwise the Canvas 2D fallback, loaded on demand so WebGL2 browsers (nearly all) never download it. Frames before the fallback finishes loading draw nothing.
The canvas's backing size is yours to set; call draw.resize(canvas.width, canvas.height) after changing it. Each frame: draw.begin(clear, logicalWidth, logicalHeight, backingPixelsPerUnit), draw, draw.end(). Call draw.dispose() when you're done with the canvas.
Parameters
canvas
HTMLCanvasElement
options?
RendererOptions = {}