27 lines
826 B
Rust
Executable file
27 lines
826 B
Rust
Executable file
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)
|
|
}
|