pub enum InputBinding {
Key(Key),
MouseButton(MouseButton),
GamepadButton {
gamepad_id: usize,
button: u32,
},
}Expand description
Represents a single input binding that can be mapped to an action.
An action can have multiple bindings, allowing for keyboard, mouse, and gamepad inputs to all trigger the same action.
Variants§
Key(Key)
A keyboard key.
MouseButton(MouseButton)
A mouse button.
GamepadButton
A gamepad button for a specific gamepad.
Implementations§
Source§impl InputBinding
impl InputBinding
Sourcepub fn is_pressed(&self, input: &InputManager) -> bool
pub fn is_pressed(&self, input: &InputManager) -> bool
Returns true if this binding is currently pressed.
Sourcepub fn is_just_pressed(&self, input: &InputManager) -> bool
pub fn is_just_pressed(&self, input: &InputManager) -> bool
Returns true if this binding was just pressed this frame.
Sourcepub fn is_just_released(&self, input: &InputManager) -> bool
pub fn is_just_released(&self, input: &InputManager) -> bool
Returns true if this binding was just released this frame.
Trait Implementations§
Source§impl Clone for InputBinding
impl Clone for InputBinding
Source§fn clone(&self) -> InputBinding
fn clone(&self) -> InputBinding
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InputBinding
impl Debug for InputBinding
Source§impl Display for InputBinding
impl Display for InputBinding
Source§impl Hash for InputBinding
impl Hash for InputBinding
Source§impl PartialEq for InputBinding
impl PartialEq for InputBinding
impl Copy for InputBinding
impl Eq for InputBinding
impl StructuralPartialEq for InputBinding
Auto Trait Implementations§
impl Freeze for InputBinding
impl RefUnwindSafe for InputBinding
impl Send for InputBinding
impl Sync for InputBinding
impl Unpin for InputBinding
impl UnsafeUnpin for InputBinding
impl UnwindSafe for InputBinding
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§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>
Converts
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>
Converts
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 more