diff --git a/Cargo.toml b/Cargo.toml index c17fc53..17b233c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,13 +14,13 @@ repository = "https://github.com/Seldom-SE/seldom_state" leafwing_input = ["dep:leafwing-input-manager"] [dependencies] -leafwing-input-manager = { git = "https://github.com/pcwalton/leafwing-input-manager", rev = "195c97c", default-features = false, optional = true } -bevy = { version = "0.15.0-rc.1", default-features = false } +leafwing-input-manager = { version = "0.16.0", default-features = false, optional = true } +bevy = { version = "0.15.0", default-features = false } either = "1.9" [dev-dependencies] -bevy = "0.15.0-rc.1" -leafwing-input-manager = { git = "https://github.com/pcwalton/leafwing-input-manager", rev = "195c97c" } +bevy = "0.15.0" +leafwing-input-manager = "0.16.0" [[example]] name = "input" diff --git a/examples/chase.rs b/examples/chase.rs index eaac89a..a352485 100644 --- a/examples/chase.rs +++ b/examples/chase.rs @@ -106,7 +106,7 @@ fn follow( follow_transform.translation += (target_translation - follow_translation) .normalize_or_zero() * follow.speed - * time.delta_seconds(); + * time.delta_secs(); } } @@ -153,5 +153,5 @@ fn move_player( ) .normalize_or_zero() * PLAYER_SPEED - * time.delta_seconds(); + * time.delta_secs(); } diff --git a/examples/done.rs b/examples/done.rs index 1749b15..f53ca7c 100644 --- a/examples/done.rs +++ b/examples/done.rs @@ -64,7 +64,7 @@ fn go_to_target( for (entity, mut transform, go_to_selection) in &mut go_to_selections { let target = go_to_selection.target; let delta = target - transform.translation.truncate(); - let movement = delta.normalize_or_zero() * go_to_selection.speed * time.delta_seconds(); + let movement = delta.normalize_or_zero() * go_to_selection.speed * time.delta_secs(); if movement.length() > delta.length() { transform.translation = target.extend(transform.translation.z); @@ -96,5 +96,5 @@ fn update_cursor_position( **position = windows .single() .cursor_position() - .and_then(|cursor_position| camera.viewport_to_world_2d(transform, cursor_position)); + .and_then(|cursor_position| camera.viewport_to_world_2d(transform, cursor_position).ok()); } diff --git a/examples/input.rs b/examples/input.rs index 9b577f3..d3362d7 100644 --- a/examples/input.rs +++ b/examples/input.rs @@ -26,14 +26,13 @@ fn init(mut commands: Commands, asset_server: Res) { // From `leafwing-input-manager` InputManagerBundle { input_map: InputMap::default() - .insert(Action::Move, VirtualAxis::horizontal_arrow_keys()) - .insert( + .with_axis(Action::Move, VirtualAxis::horizontal_arrow_keys()) + .with_axis( Action::Move, - SingleAxis::symmetric(GamepadAxisType::LeftStickX, 0.), + GamepadControlAxis::new(GamepadAxis::LeftStickX), ) - .insert(Action::Jump, KeyCode::Space) - .insert(Action::Jump, GamepadButtonType::South) - .build(), + .with(Action::Jump, KeyCode::Space) + .with(Action::Jump, GamepadButton::South), ..default() }, // This state machine achieves a very rigid movement system. Consider a state machine for @@ -63,8 +62,9 @@ fn init(mut commands: Commands, asset_server: Res) { )); } -#[derive(Actionlike, Clone, Eq, Hash, PartialEq, Reflect)] +#[derive(Actionlike, Clone, Eq, Hash, PartialEq, Reflect, Debug)] enum Action { + #[actionlike(Axis)] Move, Jump, } @@ -92,7 +92,7 @@ const PLAYER_SPEED: f32 = 200.; fn walk(mut groundeds: Query<(&mut Transform, &Grounded)>, time: Res