Skip to content

app family ​

Scenes, the scene stack and coordinator, screen layers, focus groups, and input actions, routing and replay.

Every symbol on this page is exported from the package root: import { Name } from "gamekit";

22 symbols.

SymbolSummary
ActionFrameclass. Immutable-by-interface snapshot of named logical action states for one application frame.
ActionStateclass. Complete logical state of one action for a single frame, including edges, repeat, and analog magnitude.
AppRegistrationclass. Disposable token for one coordinator or scene-stack registration.
AppSceneclass. Base scene with asynchronous lifecycle hooks, focus state, and operation input gating.
AppStateenum. Coarse coordinator phases reported to application observers.
FocusGroupclass. Supplies the default focus bookkeeping for scenes and non-UI focus groups.
FocusGroupResolverclass. Resolves one focused application group from screen windows, scene windows, and the top scene.
IFocusGroupinterface. Defines an application-level focus boundary shared by scenes and window layers.
InputContextclass. Named routing layer that declares exactly which logical actions it can receive.
InputContextKindenum. Describes the game layer receiving routed actions; routing precedence still follows context stack order, not this label.
InputPolicyclass. Builds edge-aware logical action frames by asking the core InputMap about the actions in play.
InputRecorderclass. Accumulates detached action frames for deterministic replay.
InputRecordingclass. Immutable-by-interface sequence of copied logical action frames.
InputReplayclass. Forward-only cursor over an isolated copy of an input recording.
InputRouterclass. Routes logical actions through an explicit context stack while preserving press-to-release ownership.
InputSampleclass. Normalized state of one physical control during a presentation frame.
RoutedInputclass. Per-context action-frame result produced by one InputRouter.route call.
SceneCoordinatorclass. Coordinates the application's sole scene stack with scene-scoped clocks, input contexts, assets, saves, and coarse state.
SceneOperationclass. Identifies one scene-stack mutation and lets newer work invalidate stale asynchronous completion.
SceneStackclass. Owns a game's asynchronous scene stack and keeps focus and input on only its ready top scene.
ScreenLayersclass. The two GameKit containers on Willow's screen-space root (engine.screen2d, meta-thicket scenes.md problem 10).
TickInputclass. Turns one InputPolicy frame per simulation tick into a frame a fixed-step game can consume without losing taps.

ActionFrame ​

ts
import { ActionFrame } from "gamekit";
class ActionFrame

Immutable-by-interface snapshot of named logical action states for one application frame. Missing actions read as inactive, and returned states are copies so recordings cannot be mutated indirectly.

Members

ts
constructor(states: ActionState[] = [])

Copies action states into a new frame.

  • states: Logical states to retain in their supplied order.
ts
held(action: string): boolean

Tests whether an action is continuously active in this frame.

  • action: Logical action name; unknown names are inactive.
ts
pressed(action: string): boolean

Tests whether an action changed from inactive to active in this frame.

  • action: Logical action name; unknown names are not pressed.
ts
released(action: string): boolean

Tests whether an action changed from active to inactive in this frame.

  • action: Logical action name; unknown names are not released.
ts
repeated(action: string): boolean

Tests whether the physical source reported an explicit repeat for this action.

  • action: Logical action name; unknown names are not repeated.
ts
axis(action: string): float

Reads the strongest qualifying analog value selected for an action.

  • action: Logical action name; unknown or digital-only names return zero.
ts
actions(): ActionState[]

Returns detached state copies in action-map order.

ts
copy(): ActionFrame

Clones the frame and every contained action state for independent retention.

ActionState ​

ts
import { ActionState } from "gamekit";
class ActionState

Complete logical state of one action for a single frame, including edges, repeat, and analog magnitude.

Members

ts
action: string

Logical action name, independent of any device control.

ts
held: boolean

Whether the action is active throughout this frame.

ts
pressed: boolean

Whether this frame contains the inactive-to-active edge.

ts
released: boolean

Whether this frame contains the active-to-inactive edge.

ts
repeated: boolean

Whether an active source emitted an explicit repeat in this frame.

ts
axis: float

Signed analog magnitude, or zero when no axis binding qualifies.

ts
constructor(action: string, held: boolean, pressed: boolean, released: boolean, repeated: boolean, axis: float)

Captures one already-resolved action state without further normalization.

  • action: Name associated with these resolved flags.
  • held: Continuous active flag.
  • pressed: Activation-edge flag.
  • released: Deactivation-edge flag.
  • repeated: Source repeat flag.
  • axis: Signed analog magnitude.
ts
copy(): ActionState

Returns an independent state object with the same scalar fields.

AppRegistration ​

ts
import { AppRegistration } from "gamekit";
class AppRegistration

Disposable token for one coordinator or scene-stack registration. Disposal is idempotent and prevents that registration from participating in later lifecycle work.

Members

ts
constructor(disposeWork: Function)

Wraps the cleanup callback that will run at most once.

  • disposeWork: Synchronous callback that detaches the registered item.
ts
get active(): boolean

Is true until the first call to dispose.

ts
dispose(): void

Detaches the registration once; later calls have no effect.

AppScene ​

ts
import { AppScene } from "gamekit";
class AppScene extends FocusGroup

Base scene with asynchronous lifecycle hooks, focus state, and operation input gating. A scene belongs to at most one SceneStack; its input remains disabled until it is the ready top scene. Its screen-sized UI goes in screen, a container on engine.screen2d shown, hidden and paused with the scene.

Members

ts
name: string

Human-readable scene name used in ownership diagnostics.

ts
constructor(name: string)

Creates a detached scene. @param name Non-empty diagnostic name. @throws Error when name is empty.

ts
get isInputEnabled(): boolean

Reports whether the ready top scene may receive input.

ts
get node(): any | null

The scene's node, or null when the scene has none or its node was disposed on exit. The stack pauses it while the scene is covered.

ts
get screen(): Node

The scene's screen-space container for screen-sized UI (dialogue, menus, HUDs), drawn without the camera in screen units. It is mounted under ScreenLayers.scenes on engine.screen2d once the scene has a node or a stack takes it; the stack hides and pauses it while the scene is covered, passes it with the scene's node to transitions, and replaces it with a fresh empty container when the scene is released.

ts
attachNode(node: any): void

Gives this scene the node that carries its tickers, tweens and World step. The owning SceneStack sets paused on it while the scene is covered and disposes it when the scene is released.

  • node: A node with a writable paused flag and a dispose() method.
  • Throws: Error when the node is null or the scene already has one.
ts
async enter(operation?: SceneOperation): Promise<void>

Called while input is disabled before this scene becomes active. @param operation Current operation.

ts
async exit(operation?: SceneOperation): Promise<void>

Called with input disabled before this scene is released. @param operation Current operation.

ts
async suspend(operation?: SceneOperation): Promise<void>

Called with input disabled when another scene covers this scene. @param operation Current operation.

ts
async resume(operation?: SceneOperation): Promise<void>

Called with input disabled before this scene becomes ready again. @param operation Current operation.

AppState ​

ts
import { AppState } from "gamekit";
enum AppState

Coarse coordinator phases reported to application observers. FAILURE retains the triggering error on SceneCoordinator.failure; SHUTDOWN begins before scenes exit.

MemberMeaning
BOOT = "boot"The coordinator has not begun scene entry.
LOAD = "load"A scene is loading or entering.
ACTIVE = "active"The top scene is ready to receive work.
SUSPENDED = "suspended"The active scene is temporarily paused.
SHUTDOWN = "shutdown"Shutdown has begun and scenes are exiting.
FAILURE = "failure"A lifecycle operation failed.

FocusGroup ​

ts
import { FocusGroup } from "gamekit";
class FocusGroup implements IFocusGroup

Supplies the default focus bookkeeping for scenes and non-UI focus groups. Extend it and override handleInput when a group accepts application input.

Members

ts
activateFocus(): void

Gives this group application focus.

ts
blur(): void

Removes application focus from this group.

ts
get isFocused(): boolean

Reports whether this group owns application focus.

ts
handleInput(input: any): boolean

Declines input by default so subclasses opt in explicitly.

  • input: Caller-defined input value.
  • Returns: False unless a subclass handles the value.

FocusGroupResolver ​

ts
import { FocusGroupResolver } from "gamekit";
class FocusGroupResolver

Resolves one focused application group from screen windows, scene windows, and the top scene. Resolution is screen modal, scene modal, last clicked group, then top scene, with no nested groups.

Members

ts
constructor(scene: IFocusGroup)

Creates a resolver with the current top scene as its fallback group.

  • scene: Top scene receiving focus when no window group wins.
ts
setScene(scene: IFocusGroup): void

Changes the top-scene fallback and immediately resolves focus.

  • scene: New top scene.
ts
setSceneWindowGroup(group: IFocusGroup | null): void

Associates the top scene's window layer with this resolver. @param group Scene-owned window group, or null.

ts
setScreenWindowGroup(group: IFocusGroup | null): void

Associates the persistent screen window layer with this resolver. @param group Screen-owned window group, or null.

ts
setSceneModal(group: IFocusGroup, active: boolean): void

Records whether a scene-owned modal currently forces focus. @param group Scene window group. @param active Whether its top window is modal.

ts
setScreenModal(group: IFocusGroup, active: boolean): void

Records whether a screen-owned modal currently forces focus. @param group Screen window group. @param active Whether its top window is modal.

ts
clicked(group: IFocusGroup): void

Records the group most recently clicked and resolves focus.

  • group: Scene or window group selected by pointer input.
ts
resolve(): IFocusGroup

Applies the documented priority and returns the sole focused group.

  • Returns: Screen modal, scene modal, last clicked group, or top scene.

IFocusGroup ​

ts
import { IFocusGroup } from "gamekit";
interface IFocusGroup

Defines an application-level focus boundary shared by scenes and window layers. WillowUI keeps widget focus inside a focused window; GameKit resolves only the owning group.

Members

ts
activateFocus(): void

Gives keyboard input ownership to this group.

ts
blur(): void

Releases keyboard input ownership from this group.

ts
readonly isFocused: boolean

Reports whether this group currently owns application focus.

ts
handleInput(input: any): boolean

Offers caller-defined input to the focused group.

  • input: Input value chosen by the game or adapter.
  • Returns: True when the group handled the value.

InputContext ​

ts
import { InputContext } from "gamekit";
class InputContext

Named routing layer that declares exactly which logical actions it can receive. When contexts overlap, InputRouter sends a newly held action to the most recently pushed declaring context.

Members

ts
name: string

Non-empty diagnostic name for the routing layer.

ts
kind: InputContextKind

Semantic layer label; it does not determine routing precedence.

ts
constructor(name: string, kind: InputContextKind, actions: string[])

Copies the declared action set for one routing layer.

  • name: Non-empty diagnostic name.
  • kind: Simulation, screen, modal, text-entry, or debug label.
  • actions: Logical action names this context accepts.
  • Throws: Error if name is empty.
ts
declares(action: string): boolean

Tests membership in the copied action declaration list.

  • action: Logical action name to query.
ts
actions(): string[]

Returns a detached copy of declared action names in original order.

InputContextKind ​

ts
import { InputContextKind } from "gamekit";
enum InputContextKind

Describes the game layer receiving routed actions; routing precedence still follows context stack order, not this label.

MemberMeaning
SIMULATION = "simulation"Input consumed by world or fixed-step simulation.
SCREEN = "screen"Input for a full screen or scene.
MODAL = "modal"Input for a blocking overlay.
TEXT_ENTRY = "text-entry"Input for editable text.
DEBUG = "debug"Input reserved for diagnostic controls.

InputPolicy ​

ts
import { InputPolicy } from "gamekit";
class InputPolicy

Builds edge-aware logical action frames by asking the core InputMap about the actions in play. Bindings, rebinding and persistence live in InputMap; the policy only names the actions to watch, so a game binds InputMap.bind(Action.JUMP, [Key.SPACE]) and watches "jump" here. Axis actions follow the InputMap rule: their pressed and released edges come from their two direction actions.

Members

ts
watch(action: string, id: int, keys: int[] = []): InputPolicy

Adds one action to every frame this policy builds.

  • action: Logical action name used by contexts, recordings and game code.
  • id: The InputMap action id bound for it (an enum member converted with as int).
  • keys: Keys bound to the action that WillowUI may claim for a widget. They matter only once passThrough is set; leave empty for pad-only actions.
  • Returns: This policy, for chaining.
  • Throws: Error if the name is empty or already watched.
ts
passThrough(inputManager: InputManager | null): InputPolicy

Makes the policy see only the keys WillowUI left available: a watched key the UI consumed this frame (a modal taking Escape, a focused widget taking Enter) does not press or hold its action, so one key never acts in the UI and the game at once. Read the frame after WillowUI's per-frame update.

  • inputManager: The WillowUI InputManager (its isKeyAvailable and isKeyJustAvailable are asked); GameKit requires willowui-tks. Null restores raw reads.
  • Returns: This policy, for chaining.
ts
frame(): ActionFrame

Reads InputMap for the current presentation frame, once per watched action.

  • Returns: Logical states in watch order: held, edges, and the InputMap value (-1..1 for axes, 0 or 1 for buttons).
ts
focusLost(): ActionFrame

Emits one release for every previously held action, then clears edge history.

  • Returns: Release-only frame suitable for routing before focus changes.
ts
close(): void

Rejects a pending InputMap.captureNext() so an options screen never leaves a capture running after it closes.

InputRecorder ​

ts
import { InputRecorder } from "gamekit";
class InputRecorder

Accumulates detached action frames for deterministic replay.

Members

ts
record(frame: ActionFrame): void

Appends a deep frame copy so later mutation cannot alter the recording.

  • frame: Resolved logical frame to retain.
ts
recording(): InputRecording

Snapshots all frames recorded so far into an independent recording.

ts
clear(): void

Removes retained frames without affecting recordings already produced.

InputRecording ​

ts
import { InputRecording } from "gamekit";
class InputRecording

Immutable-by-interface sequence of copied logical action frames.

Members

ts
constructor(frames: ActionFrame[])

Deep-copies the supplied frame sequence.

  • frames: Frames retained in replay order.
ts
frames(): ActionFrame[]

Returns deep copies in replay order.

ts
get frameCount(): int

Number of frames available to a new replay cursor.

InputReplay ​

ts
import { InputReplay } from "gamekit";
class InputReplay

Forward-only cursor over an isolated copy of an input recording.

Members

ts
constructor(recording: InputRecording)

Copies all recorded frames and positions the cursor before the first one.

  • recording: Source recording, which remains reusable by other cursors.
ts
get frameCount(): int

Total frames in the replay, independent of cursor position.

ts
get finished(): boolean

Is true after the cursor has consumed every frame.

ts
next(): ActionFrame

Advances once and returns a detached copy of the frame at the old cursor.

  • Throws: Error when no frames remain.

InputRouter ​

ts
import { InputRouter } from "gamekit";
class InputRouter

Routes logical actions through an explicit context stack while preserving press-to-release ownership. A held action stays captured by its original context even if higher contexts appear; removing that context queues one release.

Members

ts
push(context: InputContext): void

Places a context at highest routing precedence.

  • context: Context to add by identity.
  • Throws: Error if the same context instance is already routed.
ts
remove(context: InputContext): void

Removes a context and queues releases for actions it currently captures.

  • context: Context identity to remove; an absent context is ignored.
ts
route(frame: ActionFrame): RoutedInput

Delivers queued releases first, then routes held/released actions while maintaining captures.

  • frame: Logical action frame to distribute.
  • Returns: Per-context frames for all currently routed contexts plus any removed context owed a release.

InputSample ​

ts
import { InputSample } from "gamekit";
class InputSample

Normalized state of one physical control during a presentation frame. Platform bridges provide samples; action policy treats disconnected controls as inactive.

Members

ts
device: string

Non-empty device namespace used for exact control matching.

ts
control: string

Non-empty control name within the device namespace.

ts
value: float

Signed analog magnitude; digital controls conventionally use zero or one.

ts
connected: boolean

Whether the physical source remains connected and eligible to activate actions.

ts
repeating: boolean

Whether the source emitted an explicit repeat edge this frame.

ts
constructor(device: string, control: string, value: float, connected: boolean = true, repeating: boolean = false)

Captures one bridge-provided control reading.

  • device: Device namespace.
  • control: Control code.
  • value: Signed magnitude interpreted against binding thresholds.
  • connected: Set false for a hot-unplug sample.
  • repeating: Set true only for an explicit platform repeat.
  • Throws: Error if device or control is empty.

RoutedInput ​

ts
import { RoutedInput } from "gamekit";
class RoutedInput

Per-context action-frame result produced by one InputRouter.route call. Reads return copies, and an unknown context receives an empty frame without changing other contexts.

Members

ts
forContext(context: InputContext): ActionFrame

Returns a detached frame for one context, creating an empty bucket if needed.

  • context: Context identity whose delivered actions are requested.
ts
add(context: InputContext, state: ActionState): void

Copies an action state into a context bucket, replacing the same action if already present.

  • context: Destination context identity.
  • state: Logical state to copy.

SceneCoordinator ​

ts
import { SceneCoordinator } from "gamekit";
class SceneCoordinator

Coordinates the application's sole scene stack with scene-scoped clocks, input contexts, assets, saves, and coarse state. Input and clocks turn off before a scene hook and return only after the new top scene is ready; assets retire on exit. Scene nodes have their own ticker (game-loop spec section 3); effects scheduled on a node's ticker respect the node's pause and timeScale state, so registerClock with the scene's node ticker integrates time scaling and pause directly.game-loop.md section 6.

Members

ts
scenes: SceneStack

Sole scene-lifetime owner used by the coordinator and passive adapters.

ts
constructor(observer: Function | null = null)

Creates a coordinator in BOOT with an empty scene stack.

  • observer: Optional synchronous callback receiving every assigned AppState in order.
ts
get state(): AppState

Reports the latest coarse lifecycle state published to the observer.

ts
get failure(): Error | null

Returns the most recent caught lifecycle/save error, or null before any failure.

ts
registerClock(scene: any, clock: any): AppRegistration

Associates a pausable clock with a scene, resuming it on activation and pausing it on suspension or exit.

  • scene: Scene whose active lifetime controls the clock.
  • clock: A core Ticker (paused through its paused flag), a scene node's ticker (which respects the node's pause and timeScale), or any object exposing synchronous pause and resume methods.
  • Returns: Disposable association; disposal does not pause the clock.
  • Throws: Error if clock is null.
ts
registerInputContext(scene: any, router: any, context: any): AppRegistration

Pushes a context only while its scene is the ready top and removes it before every scene change.

  • scene: Scene that owns the context lifetime.
  • router: Object exposing push(context) and remove(context).
  • context: Neutral input context active only while its owner is the ready top scene.
  • Returns: Disposable association that removes an already-active context.
  • Throws: Error if the router or context is null.
ts
registerAssetScope(scene: any, scope: any): AppRegistration

Associates a disposable asset scope with a scene so it is released after the scene exits.

  • scene: Scene that owns the scope lifetime.
  • scope: Object exposing synchronous dispose.
  • Returns: Disposable association; early disposal detaches but does not dispose the scope.
  • Throws: Error if scope is null.
ts
registerSave(work: Function): AppRegistration

Appends asynchronous save work to the coordinator's ordered save pipeline.

  • work: Zero-argument callback awaited during each save request.
  • Returns: Disposable registration that excludes the callback from later save snapshots.
  • Throws: Error if work is null.
ts
async boot(scene: any): Promise<boolean>

Runs the one-time BOOT -> LOAD -> ACTIVE sequence and starts the first scene.

  • scene: Initial detached scene.
  • Returns: true when active; false after cancellation or a caught failure.
  • Throws: Error if boot has already been attempted.
ts
async replace(scene: any, options: { transition?: Transition } | null = null): Promise<boolean>

Publishes LOAD, replaces the top scene, then publishes ACTIVE on success.

  • scene: Detached replacement scene.
  • options: Optional { transition } forwarded to SceneStack.replace.
  • Returns: true on activation; false after cancellation or a caught failure.
ts
async push(scene: any, options: { transition?: Transition } | null = null): Promise<boolean>

Suspends the current scene and activates a new top scene without publishing LOAD.

  • scene: Detached scene to push.
  • options: Optional { transition } forwarded to SceneStack.push.
  • Returns: true on activation; false after cancellation or a caught failure.
ts
async pop(options: { transition?: Transition } | null = null): Promise<boolean>

Exits the top scene and resumes the scene beneath it.

  • options: Optional { transition } forwarded to SceneStack.pop.
  • Returns: true after the boundary completes; false after cancellation or a caught failure.
ts
async suspend(): Promise<boolean>

Suspends the current top and publishes SUSPENDED without releasing scene ownership.

  • Returns: true after suspension; false after cancellation or a caught failure.
ts
async resume(): Promise<boolean>

Resumes the current top and publishes ACTIVE.

  • Returns: true after resumption; false after cancellation or a caught failure.
ts
async save(): Promise<boolean>

Awaits a snapshot of registered save callbacks in registration order, coalescing concurrent callers onto one run.

  • Returns: true when every callback completes; false after storing the first failure.
ts
async quit(): Promise<boolean>

Coalesces quit requests, drains an in-flight save, publishes SHUTDOWN, and exits all scenes top-down.

  • Returns: true after shutdown, or false when scene teardown fails and state becomes FAILURE.

SceneOperation ​

ts
import { SceneOperation } from "gamekit";
class SceneOperation

Identifies one scene-stack mutation and lets newer work invalidate stale asynchronous completion. IDs increase within one stack. Scene hooks may call check after awaits.

Members

ts
kind: string

Stack operation such as push, replace, or shutdown.

ts
id: int

Monotonic identifier assigned by the owning SceneStack.

ts
constructor(kind: string, id: int)

Creates an active operation marker. @param kind Operation name. @param id Stack-local sequence number.

ts
get cancelled(): boolean

Reports whether newer work cancelled this operation.

ts
get cancelReason(): string

Explains cancellation, or is empty while active.

ts
cancel(reason: string = "superseded"): void

Cancels this operation. @param reason Diagnostic reason used by check.

ts
check(): void

Verifies that asynchronous scene work remains current. @throws Error when cancelled.

SceneStack ​

ts
import { SceneStack } from "gamekit";
class SceneStack

Owns a game's asynchronous scene stack and keeps focus and input on only its ready top scene. Push covers the prior scene, pop is back navigation, and replace keeps the same stack position.

Members

ts
constructor(observer: any = null)

Creates an empty stack. @param observer Optional passive scene lifecycle observer.

ts
get count(): int

Counts owned scenes, including covered scenes.

ts
get top(): any | null

Returns the focused top scene, or null when empty.

ts
scenes(): any[]

Returns a detached bottom-to-top scene snapshot.

ts
get transitioning(): boolean

Reports whether a scene lifecycle hook is still completing.

ts
addObserver(observer: any): AppRegistration

Adds a passive lifecycle observer without sharing stack ownership.

  • observer: Object implementing the _sceneChanging, _sceneActivated, _sceneSuspended, _sceneResumed, and _sceneExited hooks it needs.
  • Returns: Disposable observer registration.
  • Throws: Error for null or duplicate observers.
ts
async start(scene: any): Promise<boolean>

Enters the first scene with input gated until it is ready.

  • scene: Detached scene to own.
  • Returns: True after activation, or false when superseded.
  • Throws: Error when non-empty or the scene is already owned.
ts
async replace(scene: any, options: { transition?: Transition } | null = null): Promise<boolean>

Exits the top scene and enters a replacement without resuming a covered scene.

  • scene: Detached replacement scene.
  • options: Optional { transition }: a Willow transition played between the two scene nodes; input stays gated and the leaving node alive until it ends.
  • Returns: True after activation, or false when superseded.
ts
async push(scene: any, options: { transition?: Transition } | null = null): Promise<boolean>

Suspends the current top and pushes a new scene above it.

  • scene: Detached scene to push.
  • options: Optional { transition } played between the two scene nodes, as for replace.
  • Returns: True after activation, or false when superseded.
ts
async pop(options: { transition?: Transition } | null = null): Promise<boolean>

Pops the top scene and resumes the scene beneath it as back navigation.

  • options: Optional { transition } played from the popped scene node to the one beneath, as for replace.
  • Returns: True after the boundary, or false when superseded.
  • Throws: Error when the stack is empty.
ts
async suspend(): Promise<boolean>

Suspends the top scene in place. @returns True after suspension, or false when superseded.

ts
async resume(): Promise<boolean>

Resumes the top scene in place, enabling input only after its hook completes. @returns True after readiness.

ts
async shutdown(): Promise<void>

Exits and releases every scene from top to bottom with input disabled.

ScreenLayers ​

ts
import { ScreenLayers } from "gamekit";
class ScreenLayers

The two GameKit containers on Willow's screen-space root (engine.screen2d, meta-thicket scenes.md problem 10). scenes holds one AppScene.screen per scene, in the order the scenes were mounted; overlay is drawn above all of them and is never part of a scene transition, so a toast or debug HUD added there stays on top. Scene screens draw on WillowUI's RENDER_LAYER_UI and the overlay on RENDER_LAYER_OVERLAY, so a plain quad (a fade, a gauge) sorts with the WillowUI windows beside it in tree order.

Members

ts
static get scenes(): Node

The container under screen2d that holds each scene's screen container. Created on first read.

ts
static get overlay(): Node

The app-global screen container drawn above every scene's UI; add screen-sized nodes that outlive scenes here.

ts
static mount(): boolean

Adds both containers to Scene.main.screenRoot when a Willow scene is running and they are not there yet.

  • Returns: True when both containers are on the running scene's screen root, false without a Willow scene.

TickInput ​

ts
import { TickInput } from "gamekit";
class TickInput

Turns one InputPolicy frame per simulation tick into a frame a fixed-step game can consume without losing taps. Devices latch their edges once per presentation frame, so a game that ticks slower than it draws (or reads mid-tick) can miss a short press. This helper reads true pressed on the first tick an action is held even when the device edge fell in a frame that ran no tick, and never twice for one hold; and a direction pair declared with axis that was pressed and already released still counts as one tick of that axis, so a sub-tick tap moves one step.

Members

ts
axis(axis: string, negative: string, positive: string): TickInput

Declares a two-button axis whose sub-tick taps still count as one tick of -1 or 1.

  • axis: Name of the axis action in the frame (its value is replaced only when the frame reports 0).
  • negative: Name of the action pushing the axis to -1.
  • positive: Name of the action pushing the axis to 1.
  • Returns: This helper, for chaining.
ts
next(frame: ActionFrame): ActionFrame

Normalises this tick's frame; call exactly once per tick.

  • frame: The InputPolicy frame read this tick.
  • Returns: The frame the simulation consumes: same actions, press-once-per-hold, tap-reliable axes.