Enum ark_api::applet::input::Event

source ·
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§

source§

impl Clone for Event

source§

fn clone(&self) -> Event

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Event

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq<Event> for Event

source§

fn eq(&self, other: &Event) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

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

impl Copy for Event

source§

impl StructuralPartialEq for Event

Auto Trait Implementations§

§

impl RefUnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl UnwindSafe for Event

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.