Enum crayon::input::events::InputEvent
source · pub enum InputEvent {
MouseMoved {
position: (f32, f32),
},
MousePressed {
button: MouseButton,
},
MouseReleased {
button: MouseButton,
},
MouseWheel {
delta: (f32, f32),
},
KeyboardPressed {
key: Key,
},
KeyboardReleased {
key: Key,
},
ReceivedCharacter {
character: char,
},
Touch {
id: u8,
state: TouchState,
position: Vector2<f32>,
},
}
Expand description
Input device event, supports mouse and keyboard only.
Variants§
MouseMoved
The cursor has moved on the window. The parameter are the (x, y) coords in pixels relative to the bottom-left corner of th window.
MousePressed
Fields
Pressed event on mouse has been received.
MouseReleased
Fields
Released event from mouse has been received.
MouseWheel
A mouse wheel movement or touchpad scroll occurred.
KeyboardPressed
Pressed event on keyboard has been received.
KeyboardReleased
Released event from keyboard has been received.
ReceivedCharacter
Received a unicode character.
Touch
Represent touch event.
Every time user touches screen new Start event with some finger id is generated. When the finger is removed from the screen End event with same id is generated.
For every id there will be at least 2 events with phases Start and End (or Cancel). There may be 0 or more Move events.
Depending on platform implementation id may or may not be reused by system after End event.
Trait Implementations§
source§impl Clone for InputEvent
impl Clone for InputEvent
source§fn clone(&self) -> InputEvent
fn clone(&self) -> InputEvent
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for InputEvent
impl Debug for InputEvent
impl Copy for InputEvent
Auto Trait Implementations§
impl RefUnwindSafe for InputEvent
impl Send for InputEvent
impl Sync for InputEvent
impl Unpin for InputEvent
impl UnwindSafe for InputEvent
Blanket Implementations§
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more