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: PointerWhat kind of pointer (Mouse or Touch)?
pos: Vec2Screen-space position (in logical pixels).
ray: Ray3World-coordinate ray.
primary: booltrue 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: PointerWhat kind of pointer (Mouse or Touch)?
delta_angle: Vec2Rotation, taking into account mouse sensitivity and optional invert y axis.
delta_points: Vec2Number of logical points of movement
delta_normalized: Vec2Delta as fraction of screen width, so a delta.x=1 mean the mouse moved from one screen edge to the other.
primary: booltrue 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: booltrue if this was a press, false if this was a release.
pointer: PointerWhat kind of pointer (Mouse or Touch)?
The button being pressed or released.
pos: Vec2Screen-space position (in logical pixels).
ray: Ray3World-coordinate ray.
primary: booltrue 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: Vec2In 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: u64MIDI timestamp
len: u32Length of the valid MIDI bytes in the data buffer.
device_id: u32Device 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
