API reference
Preparing search index…

EventPayloads

Window event kinds and their payloads; all positions are client-area pixel coordinates.

interface EventPayloads {
    Closed: {};
    FocusGained: {};
    FocusLost: {};
    JoystickButtonPressed: { button: number; joystickId: number };
    JoystickButtonReleased: { button: number; joystickId: number };
    JoystickConnected: { joystickId: number };
    JoystickDisconnected: { joystickId: number };
    JoystickMoved: { axis: JoystickAxis; joystickId: number; position: number };
    KeyPressed: KeyEvent;
    KeyReleased: KeyEvent;
    MouseButtonPressed: { button: MouseButton; position: Vector2i };
    MouseButtonReleased: { button: MouseButton; position: Vector2i };
    MouseEntered: {};
    MouseLeft: {};
    MouseMoved: { position: Vector2i };
    MouseMovedRaw: { delta: Vector2i };
    MouseWheelScrolled: {
        delta: number;
        position: Vector2i;
        wheel: MouseWheel;
    };
    Resized: { size: Vector2u };
    SensorChanged: { type: SensorType; value: Vector3f };
    TextEntered: { unicode: number };
    TouchBegan: { finger: number; position: Vector2i };
    TouchEnded: { finger: number; position: Vector2i };
    TouchMoved: { finger: number; position: Vector2i };
}
Source & inheritance
Member directory23

Properties

Properties

Closed: {}

The user requested closing the window; the application must call close().

Source & inheritance
FocusGained: {}

Input focus was gained.

Source & inheritance
FocusLost: {}

Input focus was lost.

Source & inheritance
JoystickButtonPressed: { button: number; joystickId: number }

A joystick button was pressed.

Type declaration

  • button: number

    The zero-based button index.

  • joystickId: number

    The zero-based joystick index.

Source & inheritance
JoystickButtonReleased: { button: number; joystickId: number }

A joystick button was released.

Type declaration

  • button: number

    The zero-based button index.

  • joystickId: number

    The zero-based joystick index.

Source & inheritance
JoystickConnected: { joystickId: number }

A joystick was connected.

Type declaration

  • joystickId: number

    The index of the connected joystick.

Source & inheritance
JoystickDisconnected: { joystickId: number }

A joystick was disconnected.

Type declaration

  • joystickId: number

    The index of the disconnected joystick.

Source & inheritance
JoystickMoved: { axis: JoystickAxis; joystickId: number; position: number }

A joystick axis moved.

Type declaration

  • axis: JoystickAxis

    The axis that changed.

  • joystickId: number

    The zero-based joystick index.

  • position: number

    The axis position, from -100 to 100.

Source & inheritance
KeyPressed: KeyEvent

A keyboard key was pressed.

Source & inheritance
KeyReleased: KeyEvent

A keyboard key was released.

Source & inheritance
MouseButtonPressed: { button: MouseButton; position: Vector2i }

A mouse button was pressed.

Type declaration

Source & inheritance
MouseButtonReleased: { button: MouseButton; position: Vector2i }

A mouse button was released.

Type declaration

Source & inheritance
MouseEntered: {}

The mouse entered the client area.

Source & inheritance
MouseLeft: {}

The mouse left the client area.

Source & inheritance
MouseMoved: { position: Vector2i }

The mouse moved within the client area.

Type declaration

  • position: Vector2i

    The client-area pixel position.

Source & inheritance
MouseMovedRaw: { delta: Vector2i }

Raw mouse movement without system acceleration.

Type declaration

  • delta: Vector2i

    The relative movement reported by the device.

Source & inheritance
MouseWheelScrolled: { delta: number; position: Vector2i; wheel: MouseWheel }

A mouse wheel was scrolled.

Type declaration

  • delta: number

    Scroll amount, possibly fractional; positive values mean up or left.

  • position: Vector2i

    The client-area pixel position when scrolling occurred.

  • wheel: MouseWheel

    The vertical or horizontal wheel.

Source & inheritance
Resized: { size: Vector2u }

The client area changed size.

Type declaration

  • size: Vector2u

    The new client-area pixel dimensions.

Source & inheritance
SensorChanged: { type: SensorType; value: Vector3f }

A sensor measurement was updated.

Type declaration

  • type: SensorType

    The sensor type, which determines the measurement unit.

  • value: Vector3f

    The three-axis measurement.

Source & inheritance
TextEntered: { unicode: number }

A Unicode character was entered.

Type declaration

  • unicode: number

    A Unicode code point, not a UTF-16 code unit.

Source & inheritance
TouchBegan: { finger: number; position: Vector2i }

A touch began.

Type declaration

  • finger: number

    The touch index.

  • position: Vector2i

    The client-area pixel position.

Source & inheritance
TouchEnded: { finger: number; position: Vector2i }

A touch ended.

Type declaration

  • finger: number

    The touch index.

  • position: Vector2i

    The client-area pixel position.

Source & inheritance
TouchMoved: { finger: number; position: Vector2i }

A touch moved.

Type declaration

  • finger: number

    The touch index.

  • position: Vector2i

    The client-area pixel position.

Source & inheritance

Icons made by Lorc, Delapouite & Skoll · game-icons.net · CC BY 3.0