API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classScene
A scene's lifecycle host. Subclass to define scene behavior: class GameScene extends Scene { override init(): void { ... } override update(delta: Seconds): void { ... } override draw(context: RenderingContext): void { ... } } `Data` is this scene's activation-data type - the value passed to Scene.load and Scene.init. Scenes that need no activation data use the default: class TitleScene extends Scene { ... } A scene that needs typed data declares it through the generic: interface GameData { readonly level: number; } class GameScene extends Scene<GameData> { ... } `AppLike` (second generic, default Application) types Scene.app as the concrete Application subclass the scene runs under, so a project's own `Application` members are visible inside scene code, not just at the call site that constructs it: class AppScene<Data = void> extends Scene<Data, GameApplication> {} class TitleScene extends AppScene { ... } // this.app: GameApplication For a project whose own base scene needs `typeof app` (an already- constructed `Application` instance) rather than a named subclass, see ApplicationOf's doc for the explicit-fixed-point pattern required to avoid an unresolvable inference cycle. Scene-bound facilities (Scene.systems, Scene.loader, Scene.inputs, Scene.interaction, Scene.tweens, Scene.coroutines, Scene.audio, Scene.animations) are unavailable during construction and class-field initialization - they become available once the scene is attached and remain available through Scene.load, Scene.init, the frame hooks, Scene.unload, and Scene.destroy.
import { Scene } from '@codexo/exojs'A scene's lifecycle host. Subclass to define scene behavior:
class GameScene extends Scene { override init(): void { ... } override update(delta: Seconds): void { ... } override draw(context: RenderingContext): void { ... } }
`Data` is this scene's activation-data type - the value passed to Scene.load and Scene.init. Scenes that need no activation data use the default:
class TitleScene extends Scene { ... }
A scene that needs typed data declares it through the generic:
interface GameData { readonly level: number; } class GameScene extends Scene<GameData> { ... }
`AppLike` (second generic, default Application) types Scene.app as the concrete Application subclass the scene runs under, so a project's own `Application` members are visible inside scene code, not just at the call site that constructs it:
class AppScene<Data = void> extends Scene<Data, GameApplication> {} class TitleScene extends AppScene { ... } // this.app: GameApplication
For a project whose own base scene needs `typeof app` (an already- constructed `Application` instance) rather than a named subclass, see ApplicationOf's doc for the explicit-fixed-point pattern required to avoid an unresolvable inference cycle.
Scene-bound facilities (Scene.systems, Scene.loader, Scene.inputs, Scene.interaction, Scene.tweens, Scene.coroutines, Scene.audio, Scene.animations) are unavailable during construction and class-field initialization - they become available once the scene is attached and remain available through Scene.load, Scene.init, the frame hooks, Scene.unload, and Scene.destroy.
new(): Scene<Data, AppLike>destroy(): voiddraw(_context: RenderingContextOwns rendering orchestration: builds, optimizes and plays the internal RenderPlan for a RenderNode subtree, manages render-target/view state for off-screen cap…): SynchronousReturn type of the engine hooks that must not be asynchronous: Scene.init, the frame hooks Scene.fixedUpdate / Scene.update / Scene.draw, and the SystemMethods…fixedUpdate(_step: 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…): SynchronousReturn type of the engine hooks that must not be asynchronous: Scene.init, the frame hooks Scene.fixedUpdate / Scene.update / Scene.draw, and the SystemMethods…load(_data: Readonly<Data>): Promise<void> | voidtrack(item: T): Tunload(): Promise<void> | voidupdate(_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…): SynchronousReturn type of the engine hooks that must not be asynchronous: Scene.init, the frame hooks Scene.fixedUpdate / Scene.update / Scene.draw, and the SystemMethods…animations: SceneAnimationsattached: booleanaudio: SceneAudiocoroutines: SceneCoroutinesinputs: SceneInputsinteraction: SceneInteractionlifecycleSignal: AbortSignalloader: SceneLoaderpaused: booleantweens: SceneTweens