bevy/crates/bevy_input/src
Jakob Hellermann e81142611b add common run conditions to bevy_input (#7806)
# Objective

Common run conditions can be very useful for quick and ergonomic changes to when a system runs.
Specifically what I'd like to be able to do is
```rust
use bevy::prelude::*;
use bevy::input::common_conditions::input_toggle_active;

fn main() {
  App::new()
    .add_plugins(DefaultPlugins)
    .add_plugin(
      bevy_inspector_egui::quick::WorldInspectorPlugin::default()
        .run_if(input_toggle_active(true, KeyCode::Escape)
    )
    .run();
}
```

## Solution

- add `bevy_input::common_conditions` module with `input_toggle_active`, `input_pressed`, `input_just_pressed`, `input_just_released`

## Changelog

- added common run conditions for `bevy_input`
- you can now use `.add_system(jump.run_if(input_just_pressed(KeyCode::Space)))`
2023-02-25 22:08:13 +00:00
..
axis.rs add Axis::devices to get all the input devices (#5400) 2023-01-06 18:00:22 +00:00
common_conditions.rs add common run conditions to bevy_input (#7806) 2023-02-25 22:08:13 +00:00
gamepad.rs Fix small typo in gamepad.rs docs (#7411) 2023-01-29 20:11:46 +00:00
input.rs Rename schedule v3 to schedule (#7519) 2023-02-06 18:44:40 +00:00
keyboard.rs Fix minor typos in code and docs (#7378) 2023-01-27 12:12:53 +00:00
lib.rs add common run conditions to bevy_input (#7806) 2023-02-25 22:08:13 +00:00
mouse.rs Added Ref to allow immutable access with change detection (#7097) 2023-01-11 15:41:54 +00:00
touch.rs Derive Reflect + FromReflect for input types (#6232) 2022-10-26 19:52:20 +00:00