create scaffolding
This commit is contained in:
commit
82a0fbdb50
25 changed files with 6993 additions and 0 deletions
27
crates/input/src/conditions.rs
Normal file
27
crates/input/src/conditions.rs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
use bevy::prelude::*;
|
||||
|
||||
use crate::{Inputs, actions::InputAction};
|
||||
|
||||
pub fn action_pressed<T: Send + Sync + 'static>(
|
||||
action: InputAction,
|
||||
) -> impl FnMut(Res<Inputs<T>>) -> bool + Clone {
|
||||
move |inputs: Res<Inputs<T>>| inputs.pressed(action)
|
||||
}
|
||||
|
||||
pub fn action_just_pressed<T: Send + Sync + 'static>(
|
||||
action: InputAction,
|
||||
) -> impl FnMut(Res<Inputs<T>>) -> bool + Clone {
|
||||
move |inputs: Res<Inputs<T>>| inputs.just_pressed(action)
|
||||
}
|
||||
|
||||
pub fn action_released<T: Send + Sync + 'static>(
|
||||
action: InputAction,
|
||||
) -> impl FnMut(Res<Inputs<T>>) -> bool + Clone {
|
||||
move |inputs: Res<Inputs<T>>| inputs.released(action)
|
||||
}
|
||||
|
||||
pub fn action_just_released<T: Send + Sync + 'static>(
|
||||
action: InputAction,
|
||||
) -> impl FnMut(Res<Inputs<T>>) -> bool + Clone {
|
||||
move |inputs: Res<Inputs<T>>| inputs.just_released(action)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue