Cached getBoundingClientRect() of the main canvas. Refreshed in resize. Used to map pointer client coords into canvas space.
Registry of every setupCanvas-registered canvas, keyed by selector.
Display-to-buffer scale factor after the last resize (displayWidth / bufferWidth). 1 until the first resize.
Main canvas element (the one registered with CANVAS_TYPES.MAIN).
Main canvas 2D rendering context.
Main canvas buffer height (the drawing surface, not the CSS display size).
Main canvas buffer height (the drawing surface, not the CSS display size).
Main canvas buffer dimensions as a new Vec2.
Main canvas buffer width (the drawing surface, not the CSS display size).
Main canvas buffer width (the drawing surface, not the CSS display size).
Finalize the canvas registry. Called once by Game.preInit(). Validates that exactly one CANVAS_TYPES.MAIN canvas is registered and that its buffer is non-zero, caches its bounding rect, and wires the "resized" listener if Settings.enableResize. Throws on duplicate calls or invalid registry state.
Rescale every opt-in canvas (holder.resize === true) to fit the window while preserving its buffer aspect ratio. Updates style.width/style.height only — buffer dimensions don't change. Refreshes canvasBoundingClientRect, resizedSize, and ratio from the main canvas.
Set the main context's font to ${size}px "${font}". Defaults the family to Settings.font.
Register a canvas at selector with the given role tag. Initializes its context (fillStyle/strokeStyle = white, font = 12px Arial) and returns the CanvasHolder. resize defaults to Settings.enableResize. Throws if the selector doesn't match an element or has already been registered.
Tracks registered canvases and exposes the main 2D context. The width/height accessors and
sizegetter all refer to the buffer dimensions (the canvas'swidth/heightattributes — drawing-space pixels), while resizedSize and ratio describe the display size after CSS scaling.Owned by
Game(game.canman). Lifecycle: subclass registers canvases via setupCanvas in its constructor, thenpreInit()calls finishSetup.