pub struct ActionInput(/* private fields */);Expand description
A wrapper around bevy_input::Input for use with the more generic Actions.
The interface is exactly the same as bevy_input::Input. See ControlScheme for details on
how to bind inputs to actions.
use bevy::prelude::*;
use action_maps::prelude::*;
fn handle_input(mut input: ResMut<ActionInput>) {
if input.pressed("Up") {
println!("Up is pressed!");
}
}Implementations§
Source§impl ActionInput
impl ActionInput
pub fn press<A>(&mut self, input: A)
pub fn pressed<A>(&self, input: A) -> bool
pub fn any_pressed<A>(&self, inputs: impl IntoIterator<Item = A>) -> bool
pub fn release<A>(&mut self, input: A)
pub fn release_all(&mut self)
pub fn just_pressed<A>(&self, input: A) -> bool
pub fn any_just_pressed<A>(&self, inputs: impl IntoIterator<Item = A>) -> bool
pub fn clear_just_pressed<A>(&mut self, input: A)
pub fn reset<A>(&mut self, input: A)
pub fn reset_all(&mut self)
pub fn clear(&mut self)
pub fn get_pressed(&self) -> impl ExactSizeIterator<Item = &Action>
pub fn get_just_pressed(&self) -> impl ExactSizeIterator<Item = &Action>
pub fn get_just_released(&self) -> impl ExactSizeIterator<Item = &Action>
Trait Implementations§
Source§impl Clone for ActionInput
impl Clone for ActionInput
Source§fn clone(&self) -> ActionInput
fn clone(&self) -> ActionInput
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 ActionInput
impl Debug for ActionInput
Source§impl Default for ActionInput
impl Default for ActionInput
Source§fn default() -> ActionInput
fn default() -> ActionInput
Returns the “default value” for a type. Read more
impl Resource for ActionInput
Auto Trait Implementations§
impl Freeze for ActionInput
impl RefUnwindSafe for ActionInput
impl Send for ActionInput
impl Sync for ActionInput
impl Unpin for ActionInput
impl UnwindSafe for ActionInput
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates
Self using data from the given World.