Skip to main content

Function: createRenderEcsSystem()

createRenderEcsSystem(renderContext): EcsSystem<[CameraEcsComponent, PositionEcsComponent], void, RenderPassResult>

Defined in: rendering/systems/render-system.ts:255

Creates a render system that batches and renders sprites based on the camera view.

Each camera draws into its own CameraEcsComponent.renderTarget, or directly onto the canvas if it doesn't have one, clearing that destination first (according to RenderContext.clearStrategy) the first time it's used each frame. Cameras that share a destination (either the canvas or the same RenderTarget) draw on top of one another rather than each clearing what the last one drew.

run gathers each camera's sprite commands and projection matrix without drawing anything; afterRun does the actual drawing, once every camera has run, so every camera's batches are issued from a single, predictable pass over the whole tick's results.

Parameters

renderContext

RenderContext

The rendering context

Returns

EcsSystem<[CameraEcsComponent, PositionEcsComponent], void, RenderPassResult>

The render ECS system