Documentation
¶
Overview ¶
Package hostlink is what a game or tool that runs under an editor host shares with that host, whichever protocol it speaks: the protocol version, the transport interface, the connection to the host page of a browser build, and the settings the host passes (stage, first file, whether it is untitled, asset root, file index). In a browser the settings come from globalThis.weakpixelHost, which the VSCode webview defines before the game starts; natively they come from WPIX_* environment variables.
Both the level editor's bridge (editor/bridge) and the tool shell (editor/toolshell, tools/wpix-editor) build on it. It imports only the standard library, so a tool links neither the bridge nor the level editor. See doc/design/editor-protocol.md#protocol.
Index ¶
Constants ¶
const ( // EnvStage is the stage to run, "level" or "prefab" (see [Stage]). EnvStage = "WPIX_STAGE" // EnvPath is the asset key of the first file (see [Path]). EnvPath = "WPIX_PATH" // EnvHeadless is "1" to run without a window (see [Headless]). EnvHeadless = "WPIX_HEADLESS" )
Environment variables a native host sets for the game it starts. They are read on every platform except the browser, where the page's script is the host. They do not overlap the WPIX_SCREENSHOT_* variables of the engine.
const Version = 0
Version is the protocol version, sent in "ready" by the level editor's bridge and by the tool shell. A host refuses a game with a version it does not know. The extension's PROTOCOL_VERSION must equal it.
Variables ¶
This section is empty.
Functions ¶
func AssetBase ¶
AssetBase returns false: a native game reads its assets from the game's own FS, not from a host page.
func Headless ¶
func Headless() bool
Headless reports whether WPIX_HEADLESS is "1": the game runs without a window (see editor/host).
func Path ¶
func Path() string
Path returns the WPIX_PATH environment variable, the asset key of the file to open first, "" when it is not set.