Skip to content

Commit

Permalink
Merge pull request #34 from etam/bevy_0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackPhlox committed Jul 16, 2023
2 parents 680247f + 4956b06 commit 4aa8de3
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 29 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "bevy_flycam"
version = "0.10.1"
version = "0.11.0"
authors = ["Spencer Burris <sburris@posteo.net>"]
edition = "2021"
license = "ISC"
Expand All @@ -13,7 +13,7 @@ categories = ["game-engines", "game-development"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
bevy = { version = "0.10", default-features = false, features = ["bevy_render", "bevy_core_pipeline", "bevy_asset"] }
bevy = { version = "0.11", default-features = false, features = ["bevy_render", "bevy_core_pipeline", "bevy_asset"] }

[dev-dependencies]
bevy = { version = "0.10", default-features = false, features = ["x11", "wayland", "bevy_pbr", "bevy_core_pipeline", "bevy_asset"] }
bevy = { version = "0.11", default-features = false, features = ["x11", "wayland", "bevy_pbr", "bevy_core_pipeline", "bevy_asset"] }
11 changes: 6 additions & 5 deletions README.md
Expand Up @@ -4,7 +4,7 @@
![Crates.io](https://img.shields.io/crates/l/bevy_flycam)
![docs.rs](https://img.shields.io/docsrs/bevy_flycam)

A basic first-person fly camera for Bevy 0.10
A basic first-person fly camera for Bevy 0.11

## Controls

Expand All @@ -29,15 +29,15 @@ There are a few notable differences from [bevy_fly_camera](https://github.com/mc

```toml
[dependencies]
bevy = "0.10"
bevy = "0.11"
bevy_flycam = "*"
```

or

```toml
[dependencies]
bevy = "0.10"
bevy = "0.11"
bevy_flycam = { git = "https://github.com/sburris0/bevy_flycam" }
```

Expand All @@ -57,7 +57,7 @@ There are a few notable differences from [bevy_fly_camera](https://github.com/mc
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(PlayerPlugin)
.add_plugins(PlayerPlugin)
.run();
}
```
Expand All @@ -75,7 +75,7 @@ Same thing goes for the keybindings used for moving the camera.
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(PlayerPlugin)
.add_plugins(PlayerPlugin)
.insert_resource(MovementSettings {
sensitivity: 0.00015, // default: 0.00012
speed: 12.0, // default: 12.0
Expand All @@ -96,6 +96,7 @@ fn main() {
bevy_flycam's crate version follows bevy's minor version as shown:
| bevy | bevy_flycam |
| :-- | :-- |
| `0.11.0` | `0.11.0` |
| `0.10.1` | `0.10.1` |

## Contributing
Expand Down
4 changes: 2 additions & 2 deletions examples/basic.rs
Expand Up @@ -8,12 +8,12 @@ fn main() {
App::new()
.insert_resource(Msaa::Sample4)
.add_plugins(DefaultPlugins)
.add_plugin(PlayerPlugin)
.add_plugins(PlayerPlugin)
.insert_resource(MovementSettings {
sensitivity: 0.00015, // default: 0.00012
speed: 12.0, // default: 12.0
})
.add_system(setup.on_startup())
.add_systems(Startup, setup)
.run();
}

Expand Down
4 changes: 2 additions & 2 deletions examples/key_bindings.rs
Expand Up @@ -8,7 +8,7 @@ fn main() {
App::new()
.insert_resource(Msaa::Sample4)
.add_plugins(DefaultPlugins)
.add_plugin(PlayerPlugin)
.add_plugins(PlayerPlugin)
.insert_resource(MovementSettings {
sensitivity: 0.00015, // default: 0.00012
speed: 12.0, // default: 12.0
Expand All @@ -19,7 +19,7 @@ fn main() {
move_descend: KeyCode::Q,
..Default::default()
})
.add_startup_system(setup)
.add_systems(Startup, setup)
.run();
}

Expand Down
12 changes: 6 additions & 6 deletions examples/scroll.rs
Expand Up @@ -16,15 +16,15 @@ fn main() {
.insert_resource(Msaa::Sample4)
.add_plugins(DefaultPlugins)
//NoCameraPlayerPlugin as we provide the camera
.add_plugin(NoCameraPlayerPlugin)
.add_plugins(NoCameraPlayerPlugin)
.insert_resource(MovementSettings {
..Default::default()
})
// Setting initial state
.add_state::<ScrollType>()
.add_system(setup.on_startup())
.add_system(switch_scroll_type)
.add_system(scroll)
.add_systems(Startup, setup)
.add_systems(Update, switch_scroll_type)
.add_systems(Update, scroll)
.run();
}

Expand Down Expand Up @@ -78,7 +78,7 @@ fn switch_scroll_type(
keyboard_input: Res<Input<KeyCode>>,
) {
if keyboard_input.just_pressed(KeyCode::Z) {
let result = match scroll_type.0 {
let result = match scroll_type.get() {
ScrollType::MovementSpeed => ScrollType::Zoom,
ScrollType::Zoom => ScrollType::MovementSpeed,
};
Expand All @@ -96,7 +96,7 @@ fn scroll(
mut query: Query<(&FlyCam, &mut Projection)>,
) {
for event in mouse_wheel_events.iter() {
if scroll_type.0 == ScrollType::MovementSpeed {
if *scroll_type.get() == ScrollType::MovementSpeed {
settings.speed = (settings.speed + event.y * 0.1).abs();
println!("Speed: {:?}", settings.speed);
} else {
Expand Down
22 changes: 11 additions & 11 deletions src/lib.rs
Expand Up @@ -49,7 +49,7 @@ impl Default for KeyBindings {
move_left: KeyCode::A,
move_right: KeyCode::D,
move_ascend: KeyCode::Space,
move_descend: KeyCode::LShift,
move_descend: KeyCode::ShiftLeft,
toggle_grab_cursor: KeyCode::Escape,
}
}
Expand Down Expand Up @@ -212,11 +212,11 @@ impl Plugin for PlayerPlugin {
app.init_resource::<InputState>()
.init_resource::<MovementSettings>()
.init_resource::<KeyBindings>()
.add_system(setup_player.on_startup())
.add_system(initial_grab_cursor.on_startup())
.add_system(player_move)
.add_system(player_look)
.add_system(cursor_grab);
.add_systems(Startup, setup_player)
.add_systems(Startup, initial_grab_cursor)
.add_systems(Update, player_move)
.add_systems(Update, player_look)
.add_systems(Update, cursor_grab);
}
}

Expand All @@ -227,10 +227,10 @@ impl Plugin for NoCameraPlayerPlugin {
app.init_resource::<InputState>()
.init_resource::<MovementSettings>()
.init_resource::<KeyBindings>()
.add_system(initial_grab_cursor.on_startup())
.add_system(initial_grab_on_flycam_spawn.on_startup())
.add_system(player_move)
.add_system(player_look)
.add_system(cursor_grab);
.add_systems(Startup, initial_grab_cursor)
.add_systems(Startup, initial_grab_on_flycam_spawn)
.add_systems(Update, player_move)
.add_systems(Update, player_look)
.add_systems(Update, cursor_grab);
}
}

0 comments on commit 4aa8de3

Please sign in to comment.