logo
pub enum Event {
    Key {
        pressed: bool,
        key: Key,
    },
    Char(char),
    PointerMove {
        pointer: Pointer,
        pos: Vec2,
        ray: Ray3,
        primary: bool,
    },
    PointerDelta {
        pointer: Pointer,
        delta_angle: Vec2,
        delta_points: Vec2,
        delta_normalized: Vec2,
        primary: bool,
    },
    PointerButton {
        pressed: bool,
        pointer: Pointer,
        button: PointerButton,
        pos: Vec2,
        ray: Ray3,
        primary: bool,
    },
    Scroll {
        delta: Vec2,
    },
    Command(Command),
    Axis {
        axis: Axis,
        value: f32,
    },
    GamepadButton {
        button: GamepadButton,
        press: bool,
    },
    RawMidi {
        timestamp: u64,
        data: [u8; 8],
        len: u32,
        device_id: u32,
    },
}
Expand description

An input event (e.g. a key press).

Variants

Key

Fields

pressed: bool

pressed or released?

key: Key

the key in question

Keyboard key

Char(char)

A single character (presumably due to a key press)

PointerMove

Fields

pointer: Pointer

What kind of pointer (Mouse or Touch)?

pos: Vec2

Screen-space position (in logical pixels).

ray: Ray3

World-coordinate ray.

primary: bool

true for mice and first touch point. If false this is a secondary touch of some sort. You almost always want to filter on primary: true.

Absolute movement (won’t happen when mouse grabbing is on).

PointerDelta

Fields

pointer: Pointer

What kind of pointer (Mouse or Touch)?

delta_angle: Vec2

Rotation, taking into account mouse sensitivity and optional invert y axis.

delta_points: Vec2

Number of logical points of movement

delta_normalized: Vec2

Delta as fraction of screen width, so a delta.x=1 mean the mouse moved from one screen edge to the other.

primary: bool

true for mice and first touch point. If false this is a secondary touch of some sort. You almost always want to filter on primary: true.

Relative movement (also happens when mouse grabbing is on).

PointerButton

Fields

pressed: bool

true if this was a press, false if this was a release.

pointer: Pointer

What kind of pointer (Mouse or Touch)?

button: PointerButton

The button being pressed or released.

pos: Vec2

Screen-space position (in logical pixels).

ray: Ray3

World-coordinate ray.

primary: bool

true for mice and first touch point. If false this is a secondary touch of some sort. You almost always want to filter on primary: true.

Mouse button press/release or touch down/up

Scroll

Fields

delta: Vec2

In logical pixels.

Mouse scroll

Command(Command)

A command, e.g. undo

Axis

Fields

axis: Axis

The axis that moved.

value: f32

The new value of the axis.

General axis input, mainly used for gamepads.

GamepadButton

Fields

button: GamepadButton

Which gamepad button was pressed or released

press: bool

True = pressed, false = released

Gamepad button input event.

RawMidi

Fields

timestamp: u64

MIDI timestamp

data: [u8; 8]

Raw MIDI data, needs to be parsed

len: u32

Length of the valid MIDI bytes in the data buffer.

device_id: u32

Device ID

Raw MIDI event

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.