Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents a game being played.

Hierarchy

  • RuntimeGame

Index

Methods

  • areSceneAssetsLoaded(sceneName: string): boolean
  • Parameters

    • sceneName: string

    Returns boolean

    true when all the resources of the given scene are loaded (but maybe not parsed).

  • areSceneAssetsReady(sceneName: string): boolean
  • dispose(): void
  • Stop game loop, unload all scenes, dispose renderer and resources. After calling this method, the RuntimeGame should not be used anymore.

    Returns void

  • 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.

  • getAntialiasingMode(): "none" | "MSAA"
  • 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

  • getEmbeddedResourcesNames(resourceName: string): string[]
  • Returns the array of resources that are embedded to passed one.

    Parameters

    • resourceName: string

      The name of resource to find embedded resources of.

    Returns string[]

    The array of related resources names.

  • getEventsBasedObjectData(type: string): null | EventsBasedObjectData
  • 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
  • getNetworkSyncData(syncOptions: GetNetworkSyncDataOptions): null | GameNetworkSyncData
  • 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
  • getPlatformInfo(): { devicePlatform: any; hasTouch: boolean; isCordova: boolean; navigatorPlatform: string; supportedCompressionMethods: ("cs:gzip" | "cs:deflate")[] }
  • Helper function to get information about the platform running the game.

    Returns { devicePlatform: any; hasTouch: boolean; isCordova: boolean; navigatorPlatform: string; supportedCompressionMethods: ("cs:gzip" | "cs:deflate")[] }

    • devicePlatform: any
    • hasTouch: boolean
    • isCordova: boolean
    • navigatorPlatform: string
    • supportedCompressionMethods: ("cs:gzip" | "cs:deflate")[]
  • getPlayerId(): null | string
  • getScaleMode(): "linear" | "nearest"
  • getSceneAndExtensionsData(sceneName?: string): null | SceneAndExtensionsData
  • 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 | SceneAndExtensionsData

    The data associated to the scene.

  • getSceneLoadingProgress(sceneName: string): number
  • Parameters

    • sceneName: string

    Returns number

    The progress of assets loading in background for a scene (between 0 and 1).

  • getSessionId(): null | string
  • hasJustResumed(): boolean
  • Returns boolean

    true during the first frame the game is back from being hidden. This has nothing to do with _paused.

  • 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.

  • isAntialisingEnabledOnMobile(): boolean
  • 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.

  • isUsingGDevelopDevelopmentEnvironment(): boolean
  • Check if the game should call GDevelop development APIs or not.

    Unless you are contributing to GDevelop, avoid using this.

    Returns boolean

  • loadAllAssets(callback: () => void, progressCallback?: (progress: number) => void): void
  • Load all assets needed to display the 1st scene, displaying progress in renderer.

    Parameters

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

    • Optional progressCallback: (progress: number) => void
        • (progress: number): void
        • Parameters

          • progress: number

          Returns void

    Returns void

  • loadFirstAssetsAndStartBackgroundLoading(firstSceneName: string, progressCallback?: (progress: number) => void): Promise<void>
  • Load all assets needed to display the 1st scene, displaying progress in renderer.

    When a game is hot-reload, this method can be called with the current scene.

    Parameters

    • firstSceneName: string
    • Optional progressCallback: (progress: number) => void
        • (progress: number): void
        • Parameters

          • progress: number

          Returns void

    Returns Promise<void>

  • loadSceneAssets(sceneName: string, progressCallback?: (progress: number) => void): Promise<void>
  • Load all assets for a given scene, displaying progress in renderer.

    Parameters

    • sceneName: string
    • Optional progressCallback: (progress: number) => void
        • (progress: number): void
        • Parameters

          • progress: number

          Returns void

    Returns Promise<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

  • prioritizeLoadingOfScene(sceneName: string): void
  • resolveEmbeddedResource(mainResourceName: string, embeddedResourceName: string): string
  • Resolves the name of an embedded resource.

    Parameters

    • mainResourceName: string

      The name of the resource containing the embedded resource.

    • embeddedResourceName: string

      The name of the embedded resource.

    Returns string

    The resource name.

  • 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
  • updateFromNetworkSyncData(syncData: GameNetworkSyncData): void
  • wasFirstSceneLoaded(): boolean

Constructors

Properties

inventories: {}

Type declaration

shopifyClients: {}

Type declaration

  • [name: string]: any

Generated using TypeDoc