Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

winit 0.29: Ergonomics, examples + keymap cache #3

Closed
wants to merge 44 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
07ba4b2
update all examples as I could
Vrixyz Jun 14, 2023
58249c1
from<&str> for Key::Character + input methods taking into<T>
Vrixyz Jun 14, 2023
4676e2c
add an example input for a letter with shift, causing a bug where pre…
Vrixyz Jun 15, 2023
ea9339c
dynamic key mapping to rely on physical key rather than logical key
Vrixyz Jun 16, 2023
d0915f7
Merge branch 'update-winit' into update-winit-examples
Vrixyz Jun 16, 2023
936d721
Merge branch 'update-winit-examples' into update-winit-dynamic-key-ma…
Vrixyz Jun 16, 2023
ef802de
Merge branch 'update-winit' into update-winit-examples
Vrixyz Jun 28, 2023
05eed0b
Merge branch 'update-winit-examples' into update-winit-dynamic-key-ma…
Vrixyz Jun 29, 2023
3e4c560
fix bevy_input test
Vrixyz Jun 29, 2023
4428d1e
Merge branch 'update-winit' into update-winit-examples
Vrixyz Jul 20, 2023
383577c
Merge branch 'update-winit-examples' into update-winit-dynamic-key-ma…
Vrixyz Jul 20, 2023
5d0b317
Merge branch 'update-winit' into update-winit-examples
Vrixyz Jul 20, 2023
8cf252e
Merge branch 'update-winit-examples' into update-winit-dynamic-key-ma…
Vrixyz Jul 20, 2023
efc40a1
fix merge error
Vrixyz Jul 20, 2023
b1bb7e2
Merge branch 'update-winit-examples' into update-winit-dynamic-key-ma…
Vrixyz Jul 20, 2023
7c3753d
Merge branch 'update-winit' into update-winit-examples
Vrixyz Aug 31, 2023
bd7d7ca
Merge branch 'update-winit-examples' into update-winit-dynamic-key-ma…
Vrixyz Aug 31, 2023
6c03466
Merge branch 'update-winit' into update-winit-examples
Vrixyz Aug 31, 2023
cbb70fb
Merge branch 'update-winit-examples' into update-winit-dynamic-key-ma…
Vrixyz Aug 31, 2023
8f55d4f
Merge branch 'update-winit' into update-winit-examples
Vrixyz Sep 1, 2023
6c7bec8
Merge branch 'update-winit-examples' into update-winit-dynamic-key-ma…
Vrixyz Sep 1, 2023
e298928
Merge branch 'update-winit' into update-winit-examples
Vrixyz Sep 8, 2023
b4ba077
Merge branch 'update-winit-examples' into update-winit-dynamic-key-ma…
Vrixyz Sep 8, 2023
5ae19b4
Merge branch 'update-winit' into update-winit-examples
Vrixyz Sep 22, 2023
03163cc
Merge branch 'update-winit-examples' into update-winit-dynamic-key-ma…
Vrixyz Sep 22, 2023
4552746
only use Input<KeyLogic> ; but examples still use KeyCode for minimal…
Vrixyz Sep 26, 2023
0aa251b
use original naming to avoid too much diff
Vrixyz Sep 26, 2023
6a22638
register KeyLogic
Vrixyz Sep 26, 2023
fcee870
removed useless clone
Vrixyz Sep 26, 2023
7369322
fix warning
Vrixyz Sep 27, 2023
577c2e7
Merge branch 'update-winit' into update-winit-dynamic-key-mapping
Vrixyz Sep 27, 2023
89103fe
fixes to examples
Vrixyz Sep 27, 2023
b0ce1ff
Merge branch 'update-winit' into update-winit-dynamic-key-mapping
Vrixyz Oct 24, 2023
1a8b4ae
fix new example keys
Vrixyz Oct 25, 2023
d7d357e
fix other examples resource usage
Vrixyz Oct 25, 2023
5465969
update more keys api
Vrixyz Oct 25, 2023
7079867
Merge branch 'update-winit' into update-winit-dynamic-key-mapping
Vrixyz Oct 25, 2023
3214f3d
Merge branch 'update-winit' into update-winit-dynamic-key-mapping
Vrixyz Oct 28, 2023
88b922a
Merge branch 'update-winit' into update-winit-dynamic-key-mapping
Vrixyz Nov 8, 2023
35b1afa
Merge branch 'update-winit' into update-winit-dynamic-key-mapping
Vrixyz Nov 8, 2023
8ec399e
adapt transmission example with new input api
Vrixyz Nov 8, 2023
b78fd67
Merge branch 'update-winit' into update-winit-dynamic-key-mapping
Vrixyz Nov 8, 2023
47e580c
fix virtual_time example
Vrixyz Nov 8, 2023
65a2d2c
Merge branch 'update-winit' into update-winit-dynamic-key-mapping
Vrixyz Nov 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions crates/bevy_input/src/common_conditions.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::Input;
use bevy_ecs::system::Res;
use bevy_reflect::FromReflect;
use std::hash::Hash;

/// Stateful run condition that can be toggled via a input press using [`Input::just_pressed`].
Expand Down Expand Up @@ -49,7 +50,7 @@ use std::hash::Hash;
/// ```
pub fn input_toggle_active<T>(default: bool, input: T) -> impl FnMut(Res<Input<T>>) -> bool + Clone
where
T: Copy + Eq + Hash + Send + Sync + 'static,
T: FromReflect + Copy + Eq + Hash + Send + Sync + 'static,
{
let mut active = default;
move |inputs: Res<Input<T>>| {
Expand All @@ -61,7 +62,7 @@ where
/// Run condition that is active if [`Input::pressed`] is true for the given input.
pub fn input_pressed<T>(input: T) -> impl FnMut(Res<Input<T>>) -> bool + Clone
where
T: Copy + Eq + Hash + Send + Sync + 'static,
T: FromReflect + Copy + Eq + Hash + Send + Sync + 'static,
{
move |inputs: Res<Input<T>>| inputs.pressed(input)
}
Expand All @@ -82,15 +83,15 @@ where
/// ```
pub fn input_just_pressed<T>(input: T) -> impl FnMut(Res<Input<T>>) -> bool + Clone
where
T: Copy + Eq + Hash + Send + Sync + 'static,
T: FromReflect + Clone + Eq + Hash + Send + Sync + 'static,
{
move |inputs: Res<Input<T>>| inputs.just_pressed(input)
move |inputs: Res<Input<T>>| inputs.just_pressed(input.clone())
}

/// Run condition that is active if [`Input::just_released`] is true for the given input.
pub fn input_just_released<T>(input: T) -> impl FnMut(Res<Input<T>>) -> bool + Clone
where
T: Copy + Eq + Hash + Send + Sync + 'static,
T: FromReflect + Copy + Eq + Hash + Send + Sync + 'static,
{
move |inputs: Res<Input<T>>| inputs.just_released(input)
}
Expand Down
Loading