Optionalsettings: Partial<StageSettings>The stage parameters
a list of cameras (experimental)
called by the state manager when reseting the object
called by the state manager before switching to another state
an ambient light that will be added to the stage rendering
Base light level applied to every normal-mapped sprite in the
lit rendering path. Unlike Stage#ambientLight (which is
the dark overlay punched by each light's cutout), this color is
added to every lit pixel so unlit areas don't render pure
black. Defaults to black (0, 0, 0) — sprites without a
normalMap ignore it entirely.
The list of active cameras in this stage. Cameras will be rendered based on this order defined in this list. Only the "default" camera will be resized when the window or canvas is resized.
The list of active lights in this stage.
Since 19.3.0, Light2d is a first-class world Renderable — the
recommended pattern is to add lights directly to app.world (or any
container, including a sprite, so the light follows it via parent
transforms). The lights Map remains for backward compatibility:
any entry added via this.lights.set(name, light) in
onResetEvent() is automatically adopted into the world tree at
stage reset time so it renders normally.
The given constructor options
Draw the stage's ambient-light overlay with cutouts for each active
light. Called from each Camera2d inside its post-effect FBO bracket —
lights themselves render via the world tree (they're standard
Renderables); this pass only paints the dark fill that the lights cut
holes through.
Subclasses can override this method to implement custom lighting (e.g. per-pixel normal-mapped lighting via a custom shader). Called once per camera per frame.
the active renderer
the camera currently rendering this stage
the same world-to-screen X translate that
Camera2d.draw() applies to the world container (i.e.
camera.pos.x + camera.offset.x for the default camera, plus
the container's own offset for non-default cameras)
the world-to-screen Y translate (see translateX)
onDestroyEvent function
called by the state manager before switching to another state
the current application instance
onResetEvent function
called by the state manager when resetting the object
this is typically where you will load a level, add renderables, etc...
the current application instance
optional arguments passed when switching state
a default "Stage" object. every "stage" object (title screen, credits, ingame, etc...) to be managed through the state manager must inherit from this base class.
See
state