RendererPlugin
Defined in: renderer/src/RendererPlugin.ts:75
RendererPlugin wraps PixiJS v8 behind the YAGE plugin interface.
Implements
Section titled “Implements”PluginRendererAdapter
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new RendererPlugin(
config):RendererPlugin
Defined in: renderer/src/RendererPlugin.ts:148
Parameters
Section titled “Parameters”config
Section titled “config”Returns
Section titled “Returns”RendererPlugin
Properties
Section titled “Properties”fx:
EffectsHost
Defined in: renderer/src/RendererPlugin.ts:125
Screen-scope effects host — .fx.addEffect(...) attaches a filter to
app.stage, so it persists across scene transitions and composites
everything the renderer draws (every scene, every layer). Common use:
screen-wide post-process like vignette or chromatic aberration.
The handle survives scene changes; remove it explicitly when no longer wanted, or it lives until the renderer plugin is destroyed.
readonlyname:"renderer"="renderer"
Defined in: renderer/src/RendererPlugin.ts:76
Unique plugin name.
Implementation of
Section titled “Implementation of”Plugin.name
version
Section titled “version”
readonlyversion:"4.0.0"="4.0.0"
Defined in: renderer/src/RendererPlugin.ts:77
Semantic version string.
Implementation of
Section titled “Implementation of”Plugin.version
Accessors
Section titled “Accessors”application
Section titled “application”Get Signature
Section titled “Get Signature”get application():
Application
Defined in: renderer/src/RendererPlugin.ts:471
The PixiJS Application instance.
Returns
Section titled “Returns”canvas
Section titled “canvas”Get Signature
Section titled “Get Signature”get canvas():
HTMLCanvasElement
Defined in: renderer/src/RendererPlugin.ts:476
The canvas element.
Returns
Section titled “Returns”HTMLCanvasElement
Implementation of
Section titled “Implementation of”RendererAdapter.canvas
canvasSize
Section titled “canvasSize”Get Signature
Section titled “Get Signature”get canvasSize():
object
Defined in: renderer/src/RendererPlugin.ts:499
Current canvas size in CSS pixels. Changes on host resize under responsive fit.
Returns
Section titled “Returns”object
height
Section titled “height”height:
number
width:
number
croppedVirtualRects
Section titled “croppedVirtualRects”Get Signature
Section titled “Get Signature”get croppedVirtualRects(): readonly
VirtualRect[]
Defined in: renderer/src/RendererPlugin.ts:602
Rectangles of virtual space that are currently off-screen — the
complement of visibleVirtualRect inside virtualSize. Use
these for effects that need to reason about cropped regions (e.g.
fog-of-war overlays at the visible boundary).
Empty under letterbox / expand / stretch. Under cover, returns 1–2 strips.
Returns
Section titled “Returns”readonly VirtualRect[]
extendedVirtualRects
Section titled “extendedVirtualRects”Get Signature
Section titled “Get Signature”get extendedVirtualRects(): readonly
VirtualRect[]
Defined in: renderer/src/RendererPlugin.ts:639
Rectangles of the visible canvas OUTSIDE the declared virtual rect — the letterbox/expand “bars” expressed in virtual-space pixels.
Populated under letterbox and expand whenever aspect mismatches;
empty under cover and stretch. Under expand these are the
play-adjacent strips the game is expected to draw into (fog, parallax,
HUD). Under letterbox they describe where the background-color bars
land — so bar-customization can layer on top of a letterbox render.
Returns
Section titled “Returns”readonly VirtualRect[]
Get Signature
Section titled “Get Signature”get fit():
RendererFitOptions
Defined in: renderer/src/RendererPlugin.ts:504
Current fit configuration.
Returns
Section titled “Returns”isFullscreen
Section titled “isFullscreen”Get Signature
Section titled “Get Signature”get isFullscreen():
boolean
Defined in: renderer/src/RendererPlugin.ts:715
Whether the renderer’s host element is currently the fullscreen element. Reads live from the DOM, so this stays accurate when the user exits fullscreen via Esc or the browser UI.
Returns
Section titled “Returns”boolean
orientation
Section titled “orientation”Get Signature
Section titled “Get Signature”get orientation():
OrientationType|null
Defined in: renderer/src/RendererPlugin.ts:727
Current device orientation. Returns null when neither the
screen.orientation API nor the legacy window.orientation angle
is available — typical of headless tests and very old browsers.
Returns
Section titled “Returns”OrientationType | null
sceneRenderTrees
Section titled “sceneRenderTrees”Get Signature
Section titled “Get Signature”get sceneRenderTrees():
SceneRenderTreeProvider
Defined in: renderer/src/RendererPlugin.ts:644
The per-scene render tree provider.
Returns
Section titled “Returns”virtualCanvasRect
Section titled “virtualCanvasRect”Get Signature
Section titled “Get Signature”get virtualCanvasRect():
VirtualRect
Defined in: renderer/src/RendererPlugin.ts:613
Where the declared virtual rectangle sits on the canvas, in CSS pixels.
Use for DOM overlays positioned over the play area, cropping screenshots
to gameplay, or mapping CSS-coord hit regions. The rect may extend past
the canvas (negative coords, dimensions larger than canvasSize) under
cover.
Returns
Section titled “Returns”virtualSize
Section titled “virtualSize”Get Signature
Section titled “Get Signature”get virtualSize():
object
Defined in: renderer/src/RendererPlugin.ts:494
Virtual resolution size.
Returns
Section titled “Returns”object
height
Section titled “height”height:
number
width:
number
visibleCanvasRect
Section titled “visibleCanvasRect”Get Signature
Section titled “Get Signature”get visibleCanvasRect():
VirtualRect
Defined in: renderer/src/RendererPlugin.ts:625
Full canvas extent expressed in virtual-space pixels — unlike
visibleVirtualRect, not clamped to the declared virtual rect.
Under letterbox / expand on an off-aspect host this extends past
virtualSize on the unscaled axis (useful for drawing backdrops that
fill the bars). Under cover it equals visibleVirtualRect; under
stretch it equals the virtual rect.
Returns
Section titled “Returns”visibleVirtualRect
Section titled “visibleVirtualRect”Get Signature
Section titled “Get Signature”get visibleVirtualRect():
VirtualRect
Defined in: renderer/src/RendererPlugin.ts:590
Sub-rectangle of the declared virtual space that is actually on-screen.
Use this to anchor HUD / UI that must stay inside the play area; use
visibleCanvasRect if your HUD is allowed to live in the bars.
Gameplay queries should stay on virtualSize.
Under letterbox / expand / stretch this equals the full virtual
rect. Under cover the long axis is cropped by the canvas edges.
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”RendererAdapter.visibleVirtualRect
worldRoot
Section titled “worldRoot”Get Signature
Section titled “Get Signature”get worldRoot():
DisplayContainer
Defined in: renderer/src/RendererPlugin.ts:489
The container that carries the responsive-fit transform — the natural parent for things that should live inside the virtual play area (transition overlays scoped to the play rect, world-space HUD, etc.). Children operate in virtual-space pixels.
Use app.stage instead when the geometry must cover the canvas
including letterbox / expand bars (full-screen dip-to-color overlays).
Returns
Section titled “Returns”Methods
Section titled “Methods”canvasToVirtual()
Section titled “canvasToVirtual()”canvasToVirtual(
x,y):Vec2
Defined in: renderer/src/RendererPlugin.ts:521
Convert CSS pixels relative to the canvas top-left into virtual-space pixels. Inverts the stage transform currently applied by the fit controller.
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”Vec2
Implementation of
Section titled “Implementation of”RendererAdapter.canvasToVirtual
createRenderTarget()
Section titled “createRenderTarget()”createRenderTarget(
source,options):RenderTargetHandle
Defined in: renderer/src/RendererPlugin.ts:674
Create an offscreen buffer that draws source into a texture the game
owns and redraws on its own schedule — the repeatable counterpart of
createTexture, with control over when the buffer refreshes and
how many texels it gets.
Composite the result by showing target.texture (a SpriteComponent, a
mask, a filter input). See RenderTargetHandle for the coordinate
space the source is drawn in and the reasons to keep it out of the live
scene graph.
Parameters
Section titled “Parameters”source
Section titled “source”options
Section titled “options”Returns
Section titled “Returns”createTexture()
Section titled “createTexture()”createTexture(
draw):TextureResource
Defined in: renderer/src/RendererPlugin.ts:653
Bake a texture once by drawing into a temporary graphics context. The result never changes again; for a buffer the game redraws, use createRenderTarget.
Parameters
Section titled “Parameters”(graphics) => void
Returns
Section titled “Returns”exitFullscreen()
Section titled “exitFullscreen()”exitFullscreen():
Promise<void>
Defined in: renderer/src/RendererPlugin.ts:704
Exit fullscreen. No-op if the page isn’t currently fullscreen.
Returns
Section titled “Returns”Promise<void>
hitTestUI()
Section titled “hitTestUI()”hitTestUI(
x,y):boolean
Defined in: renderer/src/RendererPlugin.ts:557
Hit-test at virtual-space (x, y) and return true when the topmost
interactive Pixi container has any ancestor (including itself) marked via
markPointerConsumeContainer. Used by @yagejs/input’s drain step to
auto-claim presses landing on UI surfaces.
Scope: this only sees surfaces marked via markPointerConsumeContainer —
@yagejs/ui primitives (UIPanel, UIButton, …) plus any visual
component (Sprite, AnimatedSprite, Graphics, Text, SplitText)
configured with interactive: { consumeOnInteraction: true }. A plain
sprite is not a consume surface. UI drawn on raw Pixi containers outside
those paths — such as the @yagejs-addons/dialogue box, which never
marks its containers — is not detected. Dialogue-aware callers should
gate on DialogueController.isActive() / isChoosing() instead.
Coordinates are supplied in virtual space (matching how the input plugin
stores pointer positions); they are converted to canvas space via
FitController.virtualToCanvas before being forwarded to
EventBoundary.hitTest, which per the Pixi v8 spec expects canvas-
relative (“world space above the boundary”) coordinates. At fit ratio 1
the two spaces coincide; at any other ratio (mobile / responsive) the
conversion is required for the hit-test to land on the correct surface.
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”RendererAdapter.hitTestUI
install()
Section titled “install()”install(
context):Promise<void>
Defined in: renderer/src/RendererPlugin.ts:154
Install services into the engine context. Called in topological order.
Parameters
Section titled “Parameters”context
Section titled “context”EngineContext
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”Plugin.install
onDestroy()
Section titled “onDestroy()”onDestroy():
void
Defined in: renderer/src/RendererPlugin.ts:423
Called when the engine is destroyed.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Plugin.onDestroy
onStart()
Section titled “onStart()”onStart():
Promise<void>
Defined in: renderer/src/RendererPlugin.ts:377
Called after all plugins are installed and the engine has started.
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”Plugin.onStart
registerSystems()
Section titled “registerSystems()”registerSystems(
scheduler):void
Defined in: renderer/src/RendererPlugin.ts:419
Register systems with the scheduler. Called after install.
Parameters
Section titled “Parameters”scheduler
Section titled “scheduler”SystemScheduler
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Plugin.registerSystems
requestFullscreen()
Section titled “requestFullscreen()”requestFullscreen():
Promise<void>
Defined in: renderer/src/RendererPlugin.ts:693
Request fullscreen for the renderer’s host element. Targets the
configured container when present (so DOM overlays placed
alongside the canvas remain inside the fullscreened area), falling
back to the canvas itself otherwise. Wraps Element.requestFullscreen
with the legacy webkitRequestFullscreen fallback for iOS Safari.
Must be called from a user-gesture handler (click, touch, key);
browsers reject the returned Promise with a TypeError otherwise.
Returns
Section titled “Returns”Promise<void>
setFit()
Section titled “setFit()”setFit(
options):void
Defined in: renderer/src/RendererPlugin.ts:513
Change the fit mode and/or target at runtime.
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”void
virtualToCanvas()
Section titled “virtualToCanvas()”virtualToCanvas(
x,y):Vec2
Defined in: renderer/src/RendererPlugin.ts:530
Virtual-space pixels → CSS pixels relative to the canvas top-left. Symmetric with canvasToVirtual; useful when mapping virtual coordinates back out to DOM overlays or pointer regions.
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”Vec2