Small World Engine API Reference - v0.46.1
    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

    Constructors

    Properties

    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

    Global block flag to temporarily disable PointerLock requests (e.g. for inspector).

    Accessors

    • get isPointerLocked(): boolean

      Returns boolean

    • set isPointerLocked(v: boolean): void

      Parameters

      • v: boolean

      Returns void

    Methods

    • 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

    • Parameters

      • neg: string
      • pos: string

      Returns number

    • Initializes the input listeners.

      Returns void

    • Static wrappers

      Parameters

      • code: string

      Returns boolean

    • Returns Promise<void>

    • Parameters

      • element: HTMLElement

      Returns void