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
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)?
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
General axis input, mainly used for gamepads.
GamepadButton
Gamepad button input event.
RawMidi
Fields
timestamp: u64
MIDI timestamp
len: u32
Length of the valid MIDI bytes in the data
buffer.
device_id: u32
Device ID
Raw MIDI event
Trait Implementations
sourceimpl PartialEq<Event> for Event
impl PartialEq<Event> for Event
impl Copy for Event
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more