gameplate - v2.2.0
    Preparing search index...

    Interface Game<S, A>

    The thing createGame returns. Everything you need to play.

    interface Game<S, A extends ActionMap<S>> {
        state: () => DeepReadonly<S>;
        actions: Dispatch<A>;
        subscribe: (listener: Listener<DeepReadonly<S>>) => Unsubscribe;
        start: () => void;
        stop: () => void;
        isRunning: () => boolean;
        keyboard: Keyboard;
        pointer: Pointer;
        gamepad: Gamepad;
        store: Store<S>;
        loop: Loop;
        destroy: () => void;
    }

    Type Parameters

    Index

    Properties

    state: () => DeepReadonly<S>

    Current state. Reference-equal until something changes it.

    actions: Dispatch<A>

    Dispatchers — call these to mutate state.

    subscribe: (listener: Listener<DeepReadonly<S>>) => Unsubscribe

    Subscribe to state changes.

    start: () => void

    Begin the game loop. No-op if already running.

    stop: () => void

    Pause the game loop. No-op if already stopped.

    isRunning: () => boolean

    true while the loop is running.

    keyboard: Keyboard

    The Keyboard, if enabled. Always defined; no-op in non-browsers.

    pointer: Pointer

    The Pointer, if enabled. Always defined; no-op in non-browsers.

    gamepad: Gamepad

    The Gamepad, if enabled. Always defined; no-op in non-browsers.

    store: Store<S>

    Underlying Store — for advanced composition.

    loop: Loop

    Underlying Loop — for advanced composition.

    destroy: () => void

    Stop the loop and detach all input listeners. Call before disposing.