fix(examples): multiple action bindings in exmaple

This commit is contained in:
2026-09-04 10:24:59 +00:00
parent 9a32598eb5
commit 22333c0c8c
2 changed files with 16 additions and 10 deletions
Generated
-1
View File
@@ -428,7 +428,6 @@ dependencies = [
"bevy_derive", "bevy_derive",
"bevy_ecs", "bevy_ecs",
"bevy_input", "bevy_input",
"bevy_platform",
"bevy_reflect", "bevy_reflect",
"bevy_state", "bevy_state",
"env_logger", "env_logger",
+16 -9
View File
@@ -86,6 +86,10 @@ fn main() {
KeyCode::KeyA, KeyCode::KeyA,
))) )))
.with_condition(BindingCondition::InGameState(MyGameState::InGame)), .with_condition(BindingCondition::InGameState(MyGameState::InGame)),
Binding::new(ButtonCombination::Single(InputType::Keyboard(
KeyCode::KeyH,
)))
.with_condition(BindingCondition::InGameState(MyGameState::InGame)),
])) ]))
.with_activation_options( .with_activation_options(
ActivationOptions::new(ActivationMode::Tap, OptionsMode::Immutable).with_delay(0.05), ActivationOptions::new(ActivationMode::Tap, OptionsMode::Immutable).with_delay(0.05),
@@ -94,21 +98,24 @@ fn main() {
// the rest will be simplified // the rest will be simplified
.with( .with(
MyAction::Back, MyAction::Back,
BindingConfig::from_vec(vec![Binding::from_single(InputType::Keyboard( BindingConfig::from_vec(vec![
KeyCode::KeyS, Binding::from_single(InputType::Keyboard(KeyCode::KeyS)),
))]), Binding::from_single(InputType::Keyboard(KeyCode::KeyJ)),
]),
) )
.with( .with(
MyAction::Forward, MyAction::Forward,
BindingConfig::from_vec(vec![Binding::from_single(InputType::Keyboard( BindingConfig::from_vec(vec![
KeyCode::KeyW, Binding::from_single(InputType::Keyboard(KeyCode::KeyW)),
))]), Binding::from_single(InputType::Keyboard(KeyCode::KeyK)),
]),
) )
.with( .with(
MyAction::Right, MyAction::Right,
BindingConfig::from_vec(vec![Binding::from_single(InputType::Keyboard( BindingConfig::from_vec(vec![
KeyCode::KeyD, Binding::from_single(InputType::Keyboard(KeyCode::KeyD)),
))]), Binding::from_single(InputType::Keyboard(KeyCode::KeyL)),
]),
) )
.with( .with(
MyAction::Up, MyAction::Up,