sfml.js
    Preparing search index...

    Interface EventPayloads

    窗口事件种类及其附带数据;位置均为客户区像素坐标。

    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 };
    }
    Index

    Properties

    Closed: {}

    用户请求关闭窗口,需要应用自行调用 close()。

    FocusGained: {}

    获得输入焦点。

    FocusLost: {}

    失去输入焦点。

    JoystickButtonPressed: { button: number; joystickId: number }

    游戏手柄按钮按下。

    Type declaration

    • button: number

      从零开始的按钮编号。

    • joystickId: number

      从零开始的手柄编号。

    JoystickButtonReleased: { button: number; joystickId: number }

    游戏手柄按钮释放。

    Type declaration

    • button: number

      从零开始的按钮编号。

    • joystickId: number

      从零开始的手柄编号。

    JoystickConnected: { joystickId: number }

    游戏手柄接入。

    Type declaration

    • joystickId: number

      接入的手柄编号。

    JoystickDisconnected: { joystickId: number }

    游戏手柄断开。

    Type declaration

    • joystickId: number

      断开的手柄编号。

    JoystickMoved: { axis: JoystickAxis; joystickId: number; position: number }

    游戏手柄轴移动。

    Type declaration

    • axis: JoystickAxis

      发生变化的轴。

    • joystickId: number

      从零开始的手柄编号。

    • position: number

      轴位置,范围 -100~100。

    KeyPressed: KeyEvent

    键盘按键按下。

    KeyReleased: KeyEvent

    键盘按键释放。

    MouseButtonPressed: { button: MouseButton; position: Vector2i }

    鼠标按钮按下。

    Type declaration

    MouseButtonReleased: { button: MouseButton; position: Vector2i }

    鼠标按钮释放。

    Type declaration

    MouseEntered: {}

    鼠标进入客户区。

    MouseLeft: {}

    鼠标离开客户区。

    MouseMoved: { position: Vector2i }

    鼠标在客户区移动。

    Type declaration

    • position: Vector2i

      客户区像素位置。

    MouseMovedRaw: { delta: Vector2i }

    未经过系统加速的原始鼠标移动。

    Type declaration

    • delta: Vector2i

      设备报告的相对移动量。

    MouseWheelScrolled: { delta: number; position: Vector2i; wheel: MouseWheel }

    鼠标滚轮滚动。

    Type declaration

    • delta: number

      滚动量,可为小数;正值向上或向左。

    • position: Vector2i

      滚动时的客户区像素位置。

    • wheel: MouseWheel

      垂直或水平滚轮。

    Resized: { size: Vector2u }

    客户区尺寸变化。

    Type declaration

    • size: Vector2u

      新客户区像素尺寸。

    SensorChanged: { type: SensorType; value: Vector3f }

    传感器测量值更新。

    Type declaration

    • type: SensorType

      传感器类型,决定测量单位。

    • value: Vector3f

      三轴测量值。

    TextEntered: { unicode: number }

    输入了一个 Unicode 字符。

    Type declaration

    • unicode: number

      Unicode 码点,不是 UTF-16 代码单元。

    TouchBegan: { finger: number; position: Vector2i }

    触点开始。

    Type declaration

    • finger: number

      触点编号。

    • position: Vector2i

      客户区像素位置。

    TouchEnded: { finger: number; position: Vector2i }

    触点结束。

    Type declaration

    • finger: number

      触点编号。

    • position: Vector2i

      客户区像素位置。

    TouchMoved: { finger: number; position: Vector2i }

    触点移动。

    Type declaration

    • finger: number

      触点编号。

    • position: Vector2i

      客户区像素位置。