pub enum InputEvent<T>where
T: BindingTypes,{
Show 19 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: f32,
delta_y: f32,
},
MouseMoved {
delta_x: f32,
delta_y: f32,
},
MouseWheelMoved(ScrollDirection),
AxisMoved {
axis: T::Axis,
value: f32,
},
ControllerAxisMoved {
which: u32,
axis: ControllerAxis,
value: f32,
},
ControllerButtonPressed {
which: u32,
button: ControllerButton,
},
ControllerButtonReleased {
which: u32,
button: ControllerButton,
},
ControllerConnected {
which: u32,
},
ControllerDisconnected {
which: u32,
},
ActionPressed(T::Action),
ActionReleased(T::Action),
ActionWheelMoved(T::Action),
}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
A key was pressed down, sent exactly once per key press.
Fields
key_code: VirtualKeyCodeVirtualKeyCode, used for semantic info. i.e. “W” was pressed
KeyReleased
A key was released, sent exactly once per key release.
Fields
key_code: VirtualKeyCodeVirtualKeyCode, used for semantic info. i.e. “W” was released
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
The mouse pointer moved on screen
Fields
MouseMoved
The mouse device moved. Use this for any use of the mouse that doesn’t involve a standard mouse pointer.
Fields
MouseWheelMoved(ScrollDirection)
The mousewheel was moved in either direction
AxisMoved
An axis value changed.
Note that this variant is used for BindingTypes::Axis, not a ControllerAxis.
Fields
ControllerAxisMoved
A controller Axis was moved.
Note that this variant is used for a ControllerAxis, not BindingTypes::Axis.
Fields
axis: ControllerAxisThe axis that moved on the controller.
ControllerButtonPressed
A controller button was pressed.
ControllerButtonReleased
A controller button was released.
ControllerConnected
New controller was connected.
ControllerDisconnected
Controller was disconnected, its id might be reused later.
ActionPressed(T::Action)
The associated action had any related button or combination pressed.
If a combination is bound to an action, it will be pressed if all buttons within are pressed.
ActionReleased(T::Action)
The associated action had any related button or combination released.
If a combination is bound to an action, it will be released if any of the buttons within is released while all others are pressed.
ActionWheelMoved(T::Action)
The associated action has its mouse wheel moved.
Trait Implementations§
Source§impl<T> Clone for InputEvent<T>where
T: BindingTypes,
impl<T> Clone for InputEvent<T>where
T: BindingTypes,
Source§impl<T> Debug for InputEvent<T>
impl<T> Debug for InputEvent<T>
Source§impl<'de, T> Deserialize<'de> for InputEvent<T>
impl<'de, T> Deserialize<'de> for InputEvent<T>
Source§fn 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>,
Source§impl<'a, T> Into<InputEvent<T>> for &'a ControllerEventwhere
T: BindingTypes,
impl<'a, T> Into<InputEvent<T>> for &'a ControllerEventwhere
T: BindingTypes,
Source§fn into(self) -> InputEvent<T>
fn into(self) -> InputEvent<T>
Source§impl<T> PartialEq for InputEvent<T>
impl<T> PartialEq for InputEvent<T>
Source§impl<T> Serialize for InputEvent<T>
impl<T> Serialize for InputEvent<T>
impl<T> StructuralPartialEq for InputEvent<T>where
T: BindingTypes,
Auto Trait Implementations§
impl<T> Freeze for InputEvent<T>
impl<T> RefUnwindSafe for InputEvent<T>
impl<T> Send for InputEvent<T>
impl<T> Sync for InputEvent<T>
impl<T> Unpin for InputEvent<T>
impl<T> UnwindSafe for InputEvent<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Config for Twhere
T: for<'a> Deserialize<'a> + Serialize,
impl<T> Config for Twhere
T: for<'a> Deserialize<'a> + Serialize,
Source§fn load<P>(path: P) -> Result<T, ConfigError>
fn load<P>(path: P) -> Result<T, ConfigError>
Source§fn load_bytes(bytes: &[u8]) -> Result<T, ConfigError>
fn load_bytes(bytes: &[u8]) -> Result<T, ConfigError>
Source§fn write<P>(&self, path: P) -> Result<(), ConfigError>
fn write<P>(&self, path: P) -> Result<(), ConfigError>
Source§fn load_no_fallback<P>(path: P) -> Result<Self, ConfigError>
fn load_no_fallback<P>(path: P) -> Result<Self, ConfigError>
load insteadSource§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> SetParameter for T
impl<T> SetParameter for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.