Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents a layer of a scene, used to display objects.

Viewports and multiple cameras are not supported.

Hierarchy

  • Layer

Implements

Index

Methods

  • addEffect(effectData: EffectData): void
  • Add a new effect, or replace the one with the same name.

    Parameters

    • effectData: EffectData

      The data of the effect to add.

    Returns void

  • convertCoords(x: number, y: number, cameraId?: number): FloatPoint
  • Convert a point from the canvas coordinates (for example, the mouse position) to the scene coordinates.

    Parameters

    • x: number

      The x position, in canvas coordinates.

    • y: number

      The y position, in canvas coordinates.

    • Optional cameraId: number

      The camera number. Currently ignored.

    Returns FloatPoint

  • convertInverseCoords(x: number, y: number, cameraId?: number): FloatPoint
  • Convert a point from the scene coordinates (for example, an object position) to the canvas coordinates.

    Parameters

    • x: number

      The x position, in scene coordinates.

    • y: number

      The y position, in scene coordinates.

    • Optional cameraId: number

      The camera number. Currently ignored.

    Returns FloatPoint

  • enableEffect(name: string, enable: boolean): void
  • Enable or disable an effect.

    Parameters

    • name: string

      The name of the effect to enable or disable.

    • enable: boolean

      true to enable, false to disable

    Returns void

  • followBaseLayer(): void
  • Change the position, rotation and scale (zoom) of the layer camera to be the same as the base layer camera.

    Returns void

  • getCameraHeight(cameraId?: number): number
  • Get the camera height (which can be different than the game resolution height if the camera is zoomed).

    Parameters

    • Optional cameraId: number

      The camera number. Currently ignored.

    Returns number

    The height of the camera

  • getCameraRotation(cameraId?: number): number
  • Get the rotation of the camera, expressed in degrees.

    Parameters

    • Optional cameraId: number

      The camera number. Currently ignored.

    Returns number

    The rotation, in degrees.

  • getCameraWidth(cameraId?: number): number
  • Get the camera width (which can be different than the game resolution width if the camera is zoomed).

    Parameters

    • Optional cameraId: number

      The camera number. Currently ignored.

    Returns number

    The width of the camera

  • getCameraX(cameraId?: number): number
  • Change the camera center X position.

    Parameters

    • Optional cameraId: number

      The camera number. Currently ignored.

    Returns number

    The x position of the camera

  • getCameraY(cameraId?: number): number
  • Change the camera center Y position.

    Parameters

    • Optional cameraId: number

      The camera number. Currently ignored.

    Returns number

    The y position of the camera

  • getCameraZoom(cameraId?: number): number
  • Get the zoom of a camera.

    Parameters

    • Optional cameraId: number

      The camera number. Currently ignored.

    Returns number

    The zoom.

  • getClearColor(): number[]
  • The clear color is defined in the format [r, g, b], with components in the range of 0 to 1.

    Returns number[]

    the clear color of layer in the range of [0, 1].

  • getDefaultZOrder(): number
  • Get the default Z order to be attributed to objects created on this layer (usually from events generated code).

    Returns number

  • getHeight(): number
  • getInitialEffectsData(): EffectData[]
  • Return the initial effects data for the layer. Only to be used by renderers.

    deprecated

    Returns EffectData[]

  • getName(): string
  • getTimeScale(): number
  • getWidth(): number
  • hasEffect(name: string): boolean
  • Check if an effect exists on this layer

    Parameters

    • name: string

      The name of the effect

    Returns boolean

    true if the effect exists, false otherwise.

  • isEffectEnabled(name: string): boolean
  • Check if an effect is enabled

    Parameters

    • name: string

      The name of the effect

    Returns boolean

    true if the effect is enabled, false otherwise.

  • isLightingLayer(): boolean
  • isVisible(): boolean
  • onGameResolutionResized(): void
  • Called by the RuntimeScene whenever the game resolution size is changed. Updates the layer width/height and position.

    Returns void

  • removeEffect(effectName: string): void
  • Remove the effect with the specified name

    Parameters

    • effectName: string

      The name of the effect.

    Returns void

  • setCameraRotation(rotation: number, cameraId?: number): void
  • Set the rotation of the camera, expressed in degrees. The rotation is made around the camera center.

    Parameters

    • rotation: number

      The new rotation, in degrees.

    • Optional cameraId: number

      The camera number. Currently ignored.

    Returns void

  • setCameraX(x: number, cameraId?: number): void
  • Set the camera center X position.

    Parameters

    • x: number

      The new x position

    • Optional cameraId: number

      The camera number. Currently ignored.

    Returns void

  • setCameraY(y: number, cameraId?: number): void
  • Set the camera center Y position.

    Parameters

    • y: number

      The new y position

    • Optional cameraId: number

      The camera number. Currently ignored.

    Returns void

  • setCameraZoom(newZoom: number, cameraId?: number): void
  • Set the zoom of a camera.

    Parameters

    • newZoom: number

      The new zoom. Must be superior to 0. 1 is the default zoom.

    • Optional cameraId: number

      The camera number. Currently ignored.

    Returns void

  • setClearColor(r: number, g: number, b: number): void
  • Set the clear color in format [r, g, b], with components in the range of 0 to 1.;

    Parameters

    • r: number

      Red color component in the range 0-255.

    • g: number

      Green color component in the range 0-255.

    • b: number

      Blue color component in the range 0-255.

    Returns void

  • setDefaultZOrder(defaultZOrder: number): void
  • Set the default Z order to be attributed to objects created on this layer.

    Parameters

    • defaultZOrder: number

      The Z order to use when creating a new object from events.

    Returns void

  • setEffectBooleanParameter(name: string, parameterName: string, value: boolean): void
  • Change an effect parameter value (for parameters that are booleans).

    Parameters

    • name: string

      The name of the effect to update.

    • parameterName: string

      The name of the parameter to update.

    • value: boolean

      The new value (boolean).

    Returns void

  • setEffectDoubleParameter(name: string, parameterName: string, value: number): void
  • Change an effect parameter value (for parameters that are numbers).

    Parameters

    • name: string

      The name of the effect to update.

    • parameterName: string

      The name of the parameter to update.

    • value: number

      The new value (number).

    Returns void

  • setEffectStringParameter(name: string, parameterName: string, value: string): void
  • Change an effect parameter value (for parameters that are strings).

    Parameters

    • name: string

      The name of the effect to update.

    • parameterName: string

      The name of the parameter to update.

    • value: string

      The new value (string).

    Returns void

  • setFollowBaseLayerCamera(follow: boolean): void
  • Set whether layer's camera follows base layer's camera or not.

    Parameters

    • follow: boolean

    Returns void

  • setTimeScale(timeScale: number): void
  • Set the time scale for the objects on the layer: time will be slower if time scale is < 1, faster if > 1.

    Parameters

    • timeScale: number

      The new time scale (must be positive).

    Returns void

  • show(enable: boolean): void
  • Show (or hide) the layer.

    Parameters

    • enable: boolean

      true to show the layer, false to hide it.

    Returns void

Constructors

Generated using TypeDoc