Whether the renderer is currently running (RAF loop active).
Private_Private_Private_Private_Private_The target canvas element.
The 2D rendering context.
The logical viewport width (game coordinate space).
Center X of the viewport (viewportWidth / 2).
Center Y of the viewport (viewportHeight / 2).
The logical viewport height (game coordinate space).
The camera/pixel resolution width (canvas backing resolution).
The camera/pixel resolution height (canvas backing resolution).
Current measured FPS (updated every second).
Registers a listener for the specified event.
Event name
This emitter for chaining
Registers a one-time listener for the specified event.
The listener is automatically removed after the first invocation.
Event name
This emitter for chaining
Removes a listener for the specified event.
Event name
This emitter for chaining
Emits an event, invoking all registered listeners with the provided arguments.
If the event is "error" and no listeners are registered, the first argument (the error)
will be thrown.
Event name
true if any listeners were invoked, false otherwise
Removes all listeners for the specified event, or all listeners if no event is provided.
Event name
Optionalevent: KOptional event name to clear listeners for
This emitter for chaining
Returns the number of listeners registered for the specified event.
Event name
The event to count listeners for
The number of registered listeners
Update canvas resolution to match camera Units remain the same
Apply viewport → canvas transform Scale computed dynamically each frame
Private_
Canvas-based renderer that manages a 2D drawing context and emits a
"draw"event each frame.Handles resolution scaling (viewport vs camera), automatic clearing, and RAF loop.
Example