API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classSceneDirector
Single-active-scene controller owned by Application. Holds at most one active Scene (the current "screen"); SceneDirector.change switches to a new scene - ending the previous one permanently - with an optional SceneTransition. The `Registry` generic (inferred from `ApplicationOptions.scenes`) types the scene registry passed at construction. This class stores it bidirectionally (`byConstructor`/`byKey`) - `byConstructor` backs constructor-target registration/diagnostics checks, `byKey` backs key-based navigation (`change`/`restore` given a registered string key instead of a constructor). There is no scene stack: overlays, HUDs and pause menus belong on Scene.ui (the screen-fixed UI layer). Each activation is owned internally by a `SceneScope`, which attaches the scene's facilities, gates per-frame dispatch by SceneState, and runs teardown in the normative order; `SceneDirector` itself only tracks which scope is active and drives the transition machinery. Per-frame dispatch is split into entry points called by Application.update in normative order: SceneDirector.fixedUpdate (zero or more times), SceneDirector.update, then SceneDirector.draw. An active SceneTransitionSession is driven separately each frame via SceneDirector._updateTransition and SceneDirector._renderTransition, composited above or below the app draw systems depending on the session's `placement`.
import { SceneDirector } from '@codexo/exojs'Single-active-scene controller owned by Application. Holds at most one active Scene (the current "screen"); SceneDirector.change switches to a new scene - ending the previous one permanently - with an optional SceneTransition.
The `Registry` generic (inferred from `ApplicationOptions.scenes`) types the scene registry passed at construction. This class stores it bidirectionally (`byConstructor`/`byKey`) - `byConstructor` backs constructor-target registration/diagnostics checks, `byKey` backs key-based navigation (`change`/`restore` given a registered string key instead of a constructor).
There is no scene stack: overlays, HUDs and pause menus belong on Scene.ui (the screen-fixed UI layer). Each activation is owned internally by a `SceneScope`, which attaches the scene's facilities, gates per-frame dispatch by SceneState, and runs teardown in the normative order; `SceneDirector` itself only tracks which scope is active and drives the transition machinery.
Per-frame dispatch is split into entry points called by Application.update in normative order: SceneDirector.fixedUpdate (zero or more times), SceneDirector.update, then SceneDirector.draw. An active SceneTransitionSession is driven separately each frame via SceneDirector._updateTransition and SceneDirector._renderTransition, composited above or below the app draw systems depending on the session's `placement`.
new(app: ApplicationTop-level engine instance. Owns the canvas, render backend, scene-stack controller, the core systems (input, interaction, audio, coroutines, tweens, animations…, scenes?: Registry): SceneDirector<Registry>change(target: K, args: ChangeSceneArgsTuple type for `change()`'s single options parameter: present-and-required whenever `ChangeSceneOptions<Data>` has a required `data` field (`Data` is not `void…<InferSceneDataExtracts the activation-data type a SceneConstructor expects.<Registry[K]>>): Promise<SceneDirector<Registry>>change(target: C, args: ChangeSceneArgsTuple type for `change()`'s single options parameter: present-and-required whenever `ChangeSceneOptions<Data>` has a required `data` field (`Data` is not `void…<InferSceneDataExtracts the activation-data type a SceneConstructor expects.<C>>): Promise<SceneDirector<Registry>>destroy(): voidpause(): booleanpostFrame(delta: SecondsA length of time in seconds. The unit every duration in the public API is expressed in - frame deltas, the fixed step, elapsed totals, timer limits. It is a `n…, budget: FrameBudgetHow much of the running frame is still unspent, handed to the SystemMethods.postFrame phase. Modelled on the platform's `IdleDeadline`, so the canonical loop i…): thisrestore(target: K, options?: RestoreSceneOptionsOptions for SceneDirector.restore. No `data` field - a restored scope reuses whatever activation data it was originally prepared with; `load()`/`init()` never…): Promise<SceneDirector<Registry>>restore(target: C, options?: RestoreSceneOptionsOptions for SceneDirector.restore. No `data` field - a restored scope reuses whatever activation data it was originally prepared with; `load()`/`init()` never…): Promise<SceneDirector<Registry>>resume(): booleanunload(target: C, options: UnloadOptionsOptions passed to SceneDirector.unload.): Promise<boolean>currentScene: SceneA scene's lifecycle host. Subclass to define scene behavior: class GameScene extends Scene { override init(): void { ... } override update(delta: Seconds): voi…<void, ApplicationTop-level engine instance. Owns the canvas, render backend, scene-stack controller, the core systems (input, interaction, audio, coroutines, tweens, animations…<object>> | nullpaused: booleanonChangeScene: SignalLightweight typed event emitter. Each `Signal` represents one named notification channel (e.g. `onResize`, `onFrame`). Listeners are added with Signal.add or S…<[SceneA scene's lifecycle host. Subclass to define scene behavior: class GameScene extends Scene { override init(): void { ... } override update(delta: Seconds): voi…<void, ApplicationTop-level engine instance. Owns the canvas, render backend, scene-stack controller, the core systems (input, interaction, audio, coroutines, tweens, animations…<object>> | null]>onPause: SignalLightweight typed event emitter. Each `Signal` represents one named notification channel (e.g. `onResize`, `onFrame`). Listeners are added with Signal.add or S…<[SceneA scene's lifecycle host. Subclass to define scene behavior: class GameScene extends Scene { override init(): void { ... } override update(delta: Seconds): voi…<void, ApplicationTop-level engine instance. Owns the canvas, render backend, scene-stack controller, the core systems (input, interaction, audio, coroutines, tweens, animations…<object>>]>onResume: SignalLightweight typed event emitter. Each `Signal` represents one named notification channel (e.g. `onResize`, `onFrame`). Listeners are added with Signal.add or S…<[SceneA scene's lifecycle host. Subclass to define scene behavior: class GameScene extends Scene { override init(): void { ... } override update(delta: Seconds): voi…<void, ApplicationTop-level engine instance. Owns the canvas, render backend, scene-stack controller, the core systems (input, interaction, audio, coroutines, tweens, animations…<object>>]>onStartScene: SignalLightweight typed event emitter. Each `Signal` represents one named notification channel (e.g. `onResize`, `onFrame`). Listeners are added with Signal.add or S…<[SceneA scene's lifecycle host. Subclass to define scene behavior: class GameScene extends Scene { override init(): void { ... } override update(delta: Seconds): voi…<void, ApplicationTop-level engine instance. Owns the canvas, render backend, scene-stack controller, the core systems (input, interaction, audio, coroutines, tweens, animations…<object>>]>onStateChange: SignalLightweight typed event emitter. Each `Signal` represents one named notification channel (e.g. `onResize`, `onFrame`). Listeners are added with Signal.add or S…<[SceneStateLifecycle state of one Scene activation, owned by its internal `SceneScope` and exposed read-only via Scene.state. State is read-only from user code - it chang…, SceneStateLifecycle state of one Scene activation, owned by its internal `SceneScope` and exposed read-only via Scene.state. State is read-only from user code - it chang…, SceneA scene's lifecycle host. Subclass to define scene behavior: class GameScene extends Scene { override init(): void { ... } override update(delta: Seconds): voi…<void, ApplicationTop-level engine instance. Owns the canvas, render backend, scene-stack controller, the core systems (input, interaction, audio, coroutines, tweens, animations…<object>>]>onStopScene: SignalLightweight typed event emitter. Each `Signal` represents one named notification channel (e.g. `onResize`, `onFrame`). Listeners are added with Signal.add or S…<[SceneA scene's lifecycle host. Subclass to define scene behavior: class GameScene extends Scene { override init(): void { ... } override update(delta: Seconds): voi…<void, ApplicationTop-level engine instance. Owns the canvas, render backend, scene-stack controller, the core systems (input, interaction, audio, coroutines, tweens, animations…<object>>]>onUpdateScene: SignalLightweight typed event emitter. Each `Signal` represents one named notification channel (e.g. `onResize`, `onFrame`). Listeners are added with Signal.add or S…<[SceneA scene's lifecycle host. Subclass to define scene behavior: class GameScene extends Scene { override init(): void { ... } override update(delta: Seconds): voi…<void, ApplicationTop-level engine instance. Owns the canvas, render backend, scene-stack controller, the core systems (input, interaction, audio, coroutines, tweens, animations…<object>>]>