Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents a game being played.

Hierarchy

  • RuntimeGame

Index

Constructors

Methods

  • enableMetrics(enable: boolean): void
  • getAdaptGameResolutionAtRuntime(): boolean
  • Returns if the game resolution should be automatically adapted when the game window or screen size change. This will only be the case if the game resolution resize mode is configured to adapt the width or the height of the game.

    Returns boolean

    true if the game resolution is automatically changed according to the window/screen size.

  • getEffectsManager(): PixiEffectsManager
  • Get the effects manager of the game, which allows to manage effects on runtime objects or runtime layers.

    Returns PixiEffectsManager

    The effects manager for the game

  • getExtensionProperty(extensionName: string, propertyName: string): null | string
  • Gets an extension property from the project data.

    Parameters

    • extensionName: string

      The extension name.

    • propertyName: string

      The property name.

    Returns null | string

    The property value.

  • getExternalLayoutData(name: string): null | ExternalLayoutData
  • Get the data associated to an external layout.

    Parameters

    • name: string

      The name of the external layout.

    Returns null | ExternalLayoutData

    The data associated to the external layout or null if not found.

  • getGameData(): ProjectData
  • getGameResolutionHeight(): number
  • Get the game resolution (the size at which the game is played and rendered) height.

    Returns number

    The game resolution height, in pixels.

  • getGameResolutionResizeMode(): string
  • Returns if the width or the height of the game resolution should be changed to fit the game window - or if the game resolution should not be updated automatically (empty string).

    Returns string

    Either "" (don't change game resolution), "adaptWidth" or "adaptHeight".

  • getGameResolutionWidth(): number
  • Get the game resolution (the size at which the game is played and rendered) width.

    Returns number

    The game resolution width, in pixels.

  • getInitialObjectsData(): ObjectData[]
  • Get the data representing all the global objects of the game.

    Returns ObjectData[]

    The data associated to the global objects.

  • getMinimalFramerate(): number
  • getOriginalHeight(): number
  • Get the original height of the game, as set on the startup of the game.

    This is guaranteed to never change, even if the size of the game is changed afterwards.

    Returns number

  • getOriginalWidth(): number
  • Get the original width of the game, as set on the startup of the game.

    This is guaranteed to never change, even if the size of the game is changed afterwards.

    Returns number

  • getPixelsRounding(): boolean
  • getPlayerId(): null | string
  • getScaleMode(): "linear" | "nearest"
  • getSceneData(sceneName?: string): null | LayoutData
  • Get the data associated to a scene.

    Parameters

    • Optional sceneName: string

      The name of the scene. If not defined, the first scene will be returned.

    Returns null | LayoutData

    The data associated to the scene.

  • getSessionId(): null | string
  • hasScene(sceneName?: string): boolean
  • Check if a scene exists

    Parameters

    • Optional sceneName: string

      The name of the scene to search.

    Returns boolean

    true if the scene exists. If sceneName is undefined, true if the game has a scene.

  • isPreview(): boolean
  • Check if the game is running as a preview, launched from an editor.

    Returns boolean

    true if the current game is a preview.

  • loadAllAssets(callback: () => void, progressCallback?: (float: any) => void): void
  • Load all assets, displaying progress in renderer.

    Parameters

    • callback: () => void
        • (): void
        • Returns void

    • Optional progressCallback: (float: any) => void
        • (float: any): void
        • Parameters

          • float: any

          Returns void

    Returns void

  • onWindowInnerSizeChanged(): void
  • Called by the game renderer when the window containing the game has changed size (this can result from a resize of the window, but also other factors like a device orientation change on mobile).

    Returns void

  • pause(enable: boolean): void
  • Set or unset the game as paused. When paused, the game won't step and will be freezed. Useful for debugging.

    Parameters

    • enable: boolean

      true to pause the game, false to unpause

    Returns void

  • setAdaptGameResolutionAtRuntime(enable: boolean): void
  • Set if the game resolution should be automatically adapted when the game window or screen size change. This will only be the case if the game resolution resize mode is configured to adapt the width or the height of the game.

    Parameters

    • enable: boolean

      true to change the game resolution according to the window/screen size.

    Returns void

  • setGameResolutionResizeMode(resizeMode: string): void
  • Set if the width or the height of the game resolution should be changed to fit the game window - or if the game resolution should not be updated automatically.

    Parameters

    • resizeMode: string

      Either "" (don't change game resolution), "adaptWidth" or "adaptHeight".

    Returns void

  • setGameResolutionSize(width: number, height: number): void
  • setProjectData(projectData: ProjectData): void
  • Update the project data. Useful for hot-reloading, should not be used otherwise.

    Parameters

    • projectData: ProjectData

      The object (usually stored in data.json) containing the full project data

    Returns void

  • startCurrentSceneProfiler(onProfilerStopped: (oldProfiler: Profiler) => void): boolean
  • Start a profiler for the currently running scene.

    Parameters

    • onProfilerStopped: (oldProfiler: Profiler) => void

      Function to be called when the profiler is stopped. Will be passed the profiler as argument.

    Returns boolean

  • startGameLoop(): void
  • stopCurrentSceneProfiler(): void
  • wasFirstSceneLoaded(): boolean

Generated using TypeDoc