1681-engine / index / SceneManager
Class: SceneManager ​
Defined in: src/engine/SceneManager.ts:14
A stack of scenes. Only the top one updates; the ones under it are paused but still drawn (a pause menu over the level). Changes are queued and applied one at a time, so a scene that replaces itself from inside its own update, or an async onEnter still loading, never leaves two scenes half entered.
The camera is the engine's, not a scene's: replace resets it (Camera.reset: no target, no bounds, the default zoom) after the old scenes leave and before the new one enters, so a level's follow and bounds never hold over a title screen. push and pop leave it as it is: the scene under a pause menu keeps its view. pop flushes the resumed scene's input (Scene.useInput) before its onResume.
Constructors ​
Constructor ​
new SceneManager(engine): SceneManager;Defined in: src/engine/SceneManager.ts:20
Parameters ​
| Parameter | Type |
|---|---|
engine | Engine |
Returns ​
SceneManager
Accessors ​
all ​
Get Signature ​
get all(): readonly Scene[];Defined in: src/engine/SceneManager.ts:28
Every scene on the stack, bottom first.
Returns ​
readonly Scene[]
current ​
Get Signature ​
get current(): Scene | undefined;Defined in: src/engine/SceneManager.ts:23
The scene that updates, if any.
Returns ​
Scene | undefined
Methods ​
clear() ​
clear(): Promise<void>;Defined in: src/engine/SceneManager.ts:62
Leaves every scene (the engine is shutting down).
Returns ​
Promise<void>
pop() ​
pop(): Promise<void>;Defined in: src/engine/SceneManager.ts:50
Leaves the current scene and resumes the one under it.
Returns ​
Promise<void>
push() ​
push(scene): Promise<void>;Defined in: src/engine/SceneManager.ts:42
Pauses the current scene and enters scene over it.
Parameters ​
| Parameter | Type |
|---|---|
scene | Scene |
Returns ​
Promise<void>
replace() ​
replace(scene): Promise<void>;Defined in: src/engine/SceneManager.ts:33
Removes every scene and enters scene.
Parameters ​
| Parameter | Type |
|---|---|
scene | Scene |
Returns ​
Promise<void>