Interface SceneOptions

For configuring the properties of a Scene

SceneOptions

Example

 const options: SceneOptions = {
fpsMonitoringEnabled: true,
lighting: true,
lightOptions: {
fog: 1.3,
ambient: 0.2
},
GPUsettings: {
mode: "webgl"
},
physics: true,
physicsOptions: {
gravity: {
x: 0,
y: 1,
scale: 0.001
}
},
update: () => {
// do something
},
clear: false,
bounds: [500, 500],
FPS_BUFFER_SIZE: 60,
bindCameraTo: gameObject
}
interface SceneOptions {
    FPS_BUFFER_SIZE?: number;
    GPUsettings?: GPUsettings;
    backgroundColor?: string;
    bindCameraTo?: GameObject;
    bounds?: Vec2;
    clear?: boolean;
    fpsMonitoringEnabled?: boolean;
    layers?: Layer[];
    lightOptions?: lightingOptions;
    lighting?: boolean;
    physics?: boolean;
    physicsOptions?: WorldPhysicsOptions;
    update?: Function;
}

Properties

FPS_BUFFER_SIZE?: number

Size of the buffer used to calculate FPS, default is 60

GPUsettings?: GPUsettings

Settings for GPU.js, default {} (empty object)

backgroundColor?: string

Background color of the scene

bindCameraTo?: GameObject

Bind the camera to a GameObject, by default camera is static

bounds?: Vec2

Set the bounds of the scene, by default bounds are not enabled

clear?: boolean

Set to false to disable clearing the canvas on every tick, default is true

fpsMonitoringEnabled?: boolean

Set to true to enable an FPS counter in top-left, default is false

layers?: Layer[]

Layers in the scene. Will be rendered in the order they are in the array

lightOptions?: lightingOptions

Options for lighting, default {} (empty object)

lighting?: boolean

True to enable lighting, default is false

physics?: boolean

Set to true to enable physics (Uses matter.js under the hood), default is false. If true and no layers are specified, a default layer will be created with physics enabled. Othewise, physics is handled by each individual layer.

physicsOptions?: WorldPhysicsOptions

Options passed to matter.js engine

update?: Function

Function to run on every tick, default is an empty function

Generated using TypeDoc