Enum amethyst_input::InputEvent
source · pub enum InputEvent<T> {
Show 18 variants
KeyPressed {
key_code: VirtualKeyCode,
scancode: u32,
},
KeyReleased {
key_code: VirtualKeyCode,
scancode: u32,
},
KeyTyped(char),
MouseButtonPressed(MouseButton),
MouseButtonReleased(MouseButton),
ButtonPressed(Button),
ButtonReleased(Button),
CursorMoved {
delta_x: f64,
delta_y: f64,
},
MouseMoved {
delta_x: f64,
delta_y: f64,
},
MouseWheelMoved(ScrollDirection),
ControllerAxisMoved {
which: u32,
axis: ControllerAxis,
value: f64,
},
ControllerButtonPressed {
which: u32,
button: ControllerButton,
},
ControllerButtonReleased {
which: u32,
button: ControllerButton,
},
ControllerConnected {
which: u32,
},
ControllerDisconnected {
which: u32,
},
ActionPressed(T),
ActionReleased(T),
ActionWheelMoved(T),
}
Expand description
Events generated by the input system
Type parameter T is the type assigned to your Actions for your InputBundle or InputHandler.
Variants
KeyPressed
Fields
key_code: VirtualKeyCode
The VirtualKeyCode
, used for semantic info. i.e. “W” was pressed
scancode: u32
The scancode, used for positional info. i.e. The third key on the first row was pressed.
A key was pressed down, sent exactly once per key press.
KeyReleased
Fields
key_code: VirtualKeyCode
The VirtualKeyCode
, used for semantic info. i.e. “W” was released
scancode: u32
The scancode, used for positional info. i.e. The third key on the first row was released.
A key was released, sent exactly once per key release.
KeyTyped(char)
A unicode character was received by the window. Good for typing.
MouseButtonPressed(MouseButton)
A mouse button was pressed down, sent exactly once per press.
MouseButtonReleased(MouseButton)
A mouse button was released, sent exactly once per release.
ButtonPressed(Button)
A button was pressed.
ButtonReleased(Button)
A button was released.
CursorMoved
Fields
delta_x: f64
The amount the cursor moved horizontally in pixels.
delta_y: f64
The amount the cursor moved vertically in pixels.
The mouse pointer moved on screen
MouseMoved
Fields
delta_x: f64
The amount the mouse moved horizontally.
delta_y: f64
The amount the mouse moved vertically.
The mouse device moved. Use this for any use of the mouse that doesn’t involve a standard mouse pointer.
MouseWheelMoved(ScrollDirection)
The mousewheel was moved in either direction
ControllerAxisMoved
Fields
which: u32
The id for the controller whose axis moved.
axis: ControllerAxis
The axis that moved on the controller.
value: f64
The amount that the axis moved.
A controller Axis was moved.
ControllerButtonPressed
A controller button was pressed.
ControllerButtonReleased
A controller button was released.
ControllerConnected
Fields
which: u32
The id for the controller connected.
New controller was connected.
ControllerDisconnected
Fields
which: u32
The id for the controller disconnected.
Controller was disconnected, it’s id might be reused later.
ActionPressed(T)
The associated action had one of its keys pressed.
ActionReleased(T)
The associated action had one of its keys released.
ActionWheelMoved(T)
The associated action has its mouse wheel moved.
Trait Implementations
sourceimpl<T: Clone> Clone for InputEvent<T>
impl<T: Clone> Clone for InputEvent<T>
sourcefn clone(&self) -> InputEvent<T>
fn clone(&self) -> InputEvent<T>
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl<T: Debug> Debug for InputEvent<T>
impl<T: Debug> Debug for InputEvent<T>
sourceimpl<'de, T> Deserialize<'de> for InputEvent<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for InputEvent<T>where
T: Deserialize<'de>,
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations
impl<T> RefUnwindSafe for InputEvent<T>where
T: RefUnwindSafe,
impl<T> Send for InputEvent<T>where
T: Send,
impl<T> Sync for InputEvent<T>where
T: Sync,
impl<T> Unpin for InputEvent<T>where
T: Unpin,
impl<T> UnwindSafe for InputEvent<T>where
T: UnwindSafe,
Blanket Implementations
impl<T> Any for Twhere
T: Any,
impl<T> Any for Twhere
T: Any,
fn get_type_id(&self) -> TypeId
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
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 morefn 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 morefn 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 morefn 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