Familiar territory. Graphics keeps the RPG Maker MZ API, so existing MZ knowledge, tutorials and plugin code apply. Reactor's additions are marked with descriptions below.
The static class that carries out graphics processing.
function Graphics()
Quick Reference
Setup & Creation 1
| initialize() | Initializes the graphics system. |
Checks (True / False) 2
| isInsideCanvas() | Checks whether the specified point is inside the game canvas area. |
| isUpscaled() | Whether the canvas is shown larger than its backing store. |
Actions 11
| setTickHandler() | Register a handler for tick events. |
| startGameLoop() | Starts the game loop. |
| stopGameLoop() | Stops the game loop. |
| setStage() | Sets the stage to be rendered. |
| startLoading() | Shows the loading spinner. |
| endLoading() | Erases the loading spinner. |
| showRetryButton() | Displays a button to try to reload resources. |
| showScreen() | Shows the game screen. |
| hideScreen() | Hides the game screen. |
| requestRedraw() | Draw the composite on the next refresh, update or not. |
| showEffekseerOverlay() | Show the Effekseer overlay only while it carries screen effects. |
Updating & Drawing 1
| rendererModeName() | "WebGL", "WebGPU", or "Canvas" for a PIXI renderer, or "" when it cannot be told. |
Other 16
| printError() | Displays the error text to the screen. |
| eraseError() | Erases the loading error text. |
| pageToCanvasX() | Converts an x coordinate on the page to the corresponding x coordinate on the canvas area. |
| pageToCanvasY() | Converts a y coordinate on the page to the corresponding y coordinate on the canvas area. |
| resize() | Changes the size of the game screen. |
| realClockDelta() | Real clock delta. |
| canvasPixelRatio() | Backing-store scale for the game canvas: how many physical pixels back one game pixel on screen. |
| displayPixelRatio() | Screen pixels per CSS pixel, 1 when the browser does not say. |
| upscaleFilterInUse() | The filter the setting resolves to right now. |
| scalingReport() | One line saying how the frame reaches the screen right now: the canvas store and its ratio, the 3D pass size… |
| blitSceneBehindEffects() | Draw the composited scene — the 3D canvas when a map renders in 3D, then the game canvas — into the Effekseer… |
| rearmEffekseerState() | Make the next Effekseer draw read back and restore the context's GL state. |
| settleEffekseerState() | After endDraw(): the restoring draw has happened, stop paying for it. |
| FPSCounter() | Fps counter. |
| graphicsDeviceName() | The graphics device's name, short ("RTX 5070", "SwiftShader"), read once; "" when it will not say. |
| graphicsBackendName() | How the browser reaches the graphics device, as its renderer string says ("Direct3D 11", "Direct3D 11 on 12",… |
Setup & Creation
initialize
static sourceGraphics.initialize()
Initializes the graphics system.
Details
Initializes the graphics system.
Checks (True / False)
isInsideCanvas
static sourceGraphics.isInsideCanvas(x, y)
Checks whether the specified point is inside the game canvas area.
Details
Checks whether the specified point is inside the game canvas area.
isUpscaled
static sourceGraphics.isUpscaled()
Whether the canvas is shown larger than its backing store.
Actions
setTickHandler
static sourceGraphics.setTickHandler(handler)
Register a handler for tick events.
Details
Register a handler for tick events.
startGameLoop
static sourceGraphics.startGameLoop()
Starts the game loop.
stopGameLoop
static sourceGraphics.stopGameLoop()
Stops the game loop.
setStage
static sourceGraphics.setStage(stage)
Sets the stage to be rendered.
Details
Sets the stage to be rendered.
startLoading
static sourceGraphics.startLoading()
Shows the loading spinner.
endLoading
static sourceGraphics.endLoading()
Erases the loading spinner.
Details
Erases the loading spinner.
showRetryButton
static sourceGraphics.showRetryButton(retry)
Displays a button to try to reload resources.
Details
Displays a button to try to reload resources.
showScreen
static sourceGraphics.showScreen()
Shows the game screen.
hideScreen
static sourceGraphics.hideScreen()
Hides the game screen.
requestRedraw
static sourceGraphics.requestRedraw()
Draw the composite on the next refresh, update or not.
showEffekseerOverlay
static sourceGraphics.showEffekseerOverlay(visible)
Show the Effekseer overlay only while it carries screen effects.
Details
Show the Effekseer overlay only while it carries screen effects. A hidden canvas still draws into its buffer (the in-scene effects are drawn there and copied out), but the compositor stops blending a full-screen transparent layer over the game every frame. Only a change touches the style.
Updating & Drawing
rendererModeName
static sourceGraphics.rendererModeName(renderer)
"WebGL", "WebGPU", or "Canvas" for a PIXI renderer, or "" when it cannot be told.
Details
"WebGL", "WebGPU", or "Canvas" for a PIXI renderer, or "" when it cannot
be told. Polymorphic across PIXI versions: v8 renderers carry a name
("webgl"/"webgpu") and RendererType (1 WebGL, 2 WebGPU, 4 Canvas), v5-v7
use PIXI.RENDERER_TYPE (1 WebGL, 2 Canvas) — the numbers collide, so the
string is preferred and the enum is read from whichever PIXI is loaded.
Other
printError
static sourceGraphics.printError(name, message, error = null)
Displays the error text to the screen.
Details
Displays the error text to the screen.
eraseError
static sourceGraphics.eraseError()
Erases the loading error text.
pageToCanvasX
static sourceGraphics.pageToCanvasX(x)
Converts an x coordinate on the page to the corresponding x coordinate on the canvas area.
Details
Converts an x coordinate on the page to the corresponding x coordinate on the canvas area.
pageToCanvasY
static sourceGraphics.pageToCanvasY(y)
Converts a y coordinate on the page to the corresponding y coordinate on the canvas area.
Details
Converts a y coordinate on the page to the corresponding y coordinate on the canvas area.
resize
static sourceGraphics.resize(width, height)
Changes the size of the game screen.
Details
Changes the size of the game screen.
realClockDelta
static sourceGraphics.realClockDelta(tickerDelta)
Real clock delta. (Same as the RPG Maker MZ method of this name.)
canvasPixelRatio
static sourceGraphics.canvasPixelRatio()
Backing-store scale for the game canvas: how many physical pixels back one game pixel on screen.
Details
Backing-store scale for the game canvas: how many physical pixels back one game pixel on screen. Fullscreen used to stretch the finished frame with the browser's bilinear filter — a blur layer over the whole game. Rendering the backing store at the on-screen size instead leaves nothing to stretch: 3D geometry comes out native-sharp while UI bitmaps (windows, text, pictures) still enlarge through the GPU's smooth sampling and look exactly as soft as before. 1 when the frame is not enlarged — shrinking keeps a 1:1 store — and capped so a video wall cannot demand an enormous framebuffer.
displayPixelRatio
static sourceGraphics.displayPixelRatio()
Screen pixels per CSS pixel, 1 when the browser does not say.
upscaleFilterInUse
static sourceGraphics.upscaleFilterInUse()
The filter the setting resolves to right now.
scalingReport
static sourceGraphics.scalingReport()
One line saying how the frame reaches the screen right now: the canvas store and its ratio, the 3D pass size and its filter, the display scale and the GPU tier.
Details
One line saying how the frame reaches the screen right now: the canvas store and its ratio, the 3D pass size and its filter, the display scale and the GPU tier. Logged at debug level whenever it changes (a resize, F4), so a report of "it looks blurry" can carry the numbers.
blitSceneBehindEffects
static sourceGraphics.blitSceneBehindEffects()
Draw the composited scene — the 3D canvas when a map renders in 3D, then the game canvas — into the Effekseer overlay's framebuffer.
Details
Draw the composited scene — the 3D canvas when a map renders in 3D, then the game canvas — into the Effekseer overlay's framebuffer. Effects with distortion or darkening layers sample a captured background; on its own transparent overlay canvas that background is empty, so those layers rendered as solid black. The scene is blitted, captured into Effekseer's background texture, and cleared away again before the effects draw.
rearmEffekseerState
static sourceGraphics.rearmEffekseerState()
Make the next Effekseer draw read back and restore the context's GL state.
settleEffekseerState
static sourceGraphics.settleEffekseerState()
After endDraw(): the restoring draw has happened, stop paying for it.
FPSCounter
static sourceGraphics.FPSCounter()
Fps counter. (Same as the RPG Maker MZ method of this name.)
graphicsDeviceName
static sourceGraphics.graphicsDeviceName(renderer)
The graphics device's name, short ("RTX 5070", "SwiftShader"), read once; "" when it will not say.
graphicsBackendName
static sourceGraphics.graphicsBackendName()
How the browser reaches the graphics device, as its renderer string says ("Direct3D 11", "Direct3D 11 on 12", "OpenGL", "Vulkan", "Metal"); "" where it does not say or draws in software.
Details
How the browser reaches the graphics device, as its renderer string says ("Direct3D 11", "Direct3D 11 on 12", "OpenGL", "Vulkan", "Metal"); "" where it does not say or draws in software. Read after graphicsDeviceName.