megalanthusdefold-gamepush
megalanthus/defold-gamepush/gamepush.core.platform
GamePush platform: which platform the game runs on, its capabilities and calls into its native SDK.
- GitHub: megalanthus/defold-gamepush — pinned to
v1.4.1- Pick a release from megalanthus/defold-gamepush releases and add its Source code (zip) URL (or a packaged
.zipasset, if the library ships one) togame.projectunder[project]dependencies, then Fetch Libraries in the Defold editor. - Run
bunx @defold-typescript/cli resolveto materialize its types. - Import it under a namespace alias of your choice:
import * as core_platform from "gamepush.core.platform"
- Pick a release from megalanthus/defold-gamepush releases and add its Source code (zip) URL (or a packaged
Functions
type(): string
The platform the game runs on. The SDK can report platforms this module has no constant for, so compare against the constants rather than narrowing to them.
Returns
string
has_integrated_auth(): boolean
Whether the platform signs the player in itself.
Returns
boolean
is_external_links_allowed(): boolean
Whether the platform allows external links.
Returns
boolean
is_secret_code_auth_available(): boolean
Whether sign-in by secret code is available.
Returns
boolean
call_native_sdk(method: string, parameters?: unknown, callback?: (result: unknown) => void): unknown
Calls a method of the platform's native SDK, or reads one of its objects or fields.
Raises when the method is not a non-empty string. An error comes back as
{ error = "..." }.
Parameters
method:string— The dotted path to the method, object or field, for example"feedback.canReview".var=pathsaves the result in a JS variable,var:methodcalls a method of a saved object.parameters?:unknown— The method's argument, or a list of its arguments. Functions cannot be passed. Ignored when the path names an object or a field.callback?:(result: unknown) => void— Receives the result when the method returns a promise.
Returns
unknown— The result, or nothing when a callback is given.
Variables
NONE: "NONE"
No platform.
CRAZY_GAMES: "CRAZY_GAMES"
CrazyGames.
GAME_DISTRIBUTION: "GAME_DISTRIBUTION"
GameDistribution.
GAME_MONETIZE: "GAME_MONETIZE"
GameMonetize.
OK: "OK"
Odnoklassniki.
SMARTMARKET: "SMARTMARKET"
SmartMarket.
VK: "VK"
VK.
YANDEX: "YANDEX"
Yandex Games.
GAMEPIX: "GAMEPIX"
GamePix.
POKI: "POKI"
Poki.
VK_PLAY: "VK_PLAY"
VK Play.
WG_PLAYGROUND: "WG_PLAYGROUND"
WG Playground.