initialises a new instance of the Engine.
Lifecycle and update callbacks.
Configuration options for the engine.
Current background colour.
Registered engine callbacks.
Current frames per second (rolling average).
Current frame time in milliseconds.
Pixel height of the canvas.
Pixel width of the canvas.
Sets the CSS cursor style for the game canvas.
The CSS cursor value (e.g., 'pointer', 'crosshair').
Current mouse x position in world space.
Current mouse y position in world space.
Current availability of the optional world shader.
StaticcameraThe global camera instance.
StaticcurrentStaticdebugToggle for visual debug mode (hitboxes and stats).
StaticdebugRecent collisions for debug visualization.
StaticdebugWhether debug resizing preserves the object's proportions by default.
StaticdebugWorld units per cell for debug dragging and the viewport grid. Zero disables snapping.
StaticdebugSnap paused debug drags to the visible objects' edges and centres.
StaticdebugWhether debug rotation snaps to 15° by default.
StaticobjectsGlobal set of game objects if no scene is active.
StaticpausedWhether the game loop is currently paused.
StaticrenderingThe global rendering system.
StaticselectedThe currently selected object in debug mode.
StaticshowWhether to show collision normals/contact points in debug mode.
StaticshowWhether to draw the on-canvas stats and inspector in debug mode.
StaticshowWhether to show velocity/acceleration vectors in debug mode.
StaticsortedThe cached list of globally registered game objects, sorted by z-index.
StatictotalReturns the total active time of the game (excluding pause time).
StaticzWhether the global object list needs to be re-sorted by z-index.
Separates the world's colour channels in screen pixels.
Starts a countdown timer that runs a function every second and an ending function.
The total duration of the countdown.
The function to run every second.
The function to run when the countdown is finished.
Installs one full-screen world shader, or removes it when passed null. The previous shader remains in use if the new source cannot be installed.
Updates custom float and vector uniforms on the installed shader.
Schedules a function to run after a delay.
The function to run.
The delay in milliseconds.
A timer ID.
Shakes the world in screen pixels for a duration in seconds.
Completely stops this engine and cleans up its resources.
Switches scenes at the midpoint of a visual transition.
StaticcleanCleans up expired debug collisions.
Current timestamp.
StaticdestroyDestroy all objects in the active scene or global engine.
StaticdestroyRemoves a game object from the active scene or global engine loop.
The object to destroy.
StaticemitEmits a custom event on the global engine bus.
The event type.
Optionaldetail: unknown
Optional data to pass with the event.
StaticobserveObserve construction after the base components are initialised and before subclasses finish.
StaticobserveInspect completed ScreenUI frames and optionally preview screen-space edits. Return undefined from getEditing to restore game input and the original positions.
OptionalgetSourceIndex: () => number | undefinedOptionalgetEditing: () => ScreenUIEditing | undefinedStaticoffStops listening for an event on the global engine bus.
The event type.
The function to remove.
StaticonListens for an event on the global engine bus.
The event type (e.g., 'paused', 'PLAYER_DIED').
The function to run when the event occurs.
StaticregisterRegisters a game object with the active scene or global engine loop.
The object to register.
StaticresetResets the engine state to its initial values. Useful for testing to prevent state bleed between test cases.
StaticterminateStops the current engine, if one is running.
The core singleton class that manages the game loop, rendering, and scene state.