Small World Engine API Reference - v0.76.20
    Preparing search index...

    Class Input

    Handles user input (keyboard and mouse). Implements a static singleton pattern for global access, but can be instantiated or mocked for testing.

    Implements

    Index
    debug: boolean = false

    Whether debug mode is enabled for input.

    isPointerLocked: boolean = false

    Whether the pointer is currently locked.

    mouse: MouseState = ...

    Mouse state including position and button status.

    preventPointerLock: boolean = false
    • Initializes the input listeners.

      Returns void

    • Returns Promise<void>

    • Parameters

      • element: HTMLElement

      Returns void

    • Helper for testing to manually set key state.

      Parameters

      • code: string
      • pressed: boolean

      Returns void

    • Polls gamepad look axes and accumulates them into mouse deltas. Should be called once per frame.

      Returns void