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

Migrate to bevy v0.6 #12

Merged
merged 5 commits into from Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 11 additions & 11 deletions Cargo.toml
@@ -1,23 +1,23 @@
[package]
name = "bevy_flycam"
version = "0.5.1"
authors = ["Spencer Burris <sburris@posteo.net>"]
edition = "2018"
license = "ISC"
categories = ["game-engines", "game-development"]
description = "Basic first-person fly camera for the Bevy game engine"
edition = "2018"
homepage = "https://github.com/sburris0/bevy_flycam/"
repository = "https://github.com/sburris0/bevy_flycam/"
keywords = ["gamedev", "bevy", "3d", "camera"]
license = "ISC"
name = "bevy_flycam"
readme = "README.md"
keywords = ["gamedev", "bevy", "3d", "camera", ]
categories = ["game-engines", "game-development"]

repository = "https://github.com/sburris0/bevy_flycam/"
resolver = "2"
version = "0.6.0"

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

[dev-dependencies]
bevy = { version = "0.5", default-features = false, features = ["render", "bevy_winit", "bevy_wgpu" ] }
bevy = {version = "0.6", default-features = false, features = ["render", "bevy_render", "bevy_winit"]}

[target.'cfg(target_os = "linux")'.dev-dependencies]
bevy = { version = "0.5", default-features = false, features = [ "x11", "wayland" ] }
bevy = {version = "0.6", default-features = false, features = ["x11", "wayland"]}
4 changes: 2 additions & 2 deletions examples/basic.rs
Expand Up @@ -9,7 +9,7 @@ use bevy_flycam::PlayerPlugin;
//https://github.com/bevyengine/bevy/blob/latest/examples/3d/3d_scene.rs

fn main() {
App::build()
App::new()
.insert_resource(Msaa { samples: 4 })
.add_plugins(DefaultPlugins)
.add_plugin(PlayerPlugin)
Expand Down Expand Up @@ -41,7 +41,7 @@ fn setup(
..Default::default()
});
// light
commands.spawn_bundle(LightBundle {
commands.spawn_bundle(PointLightBundle {
transform: Transform::from_xyz(4.0, 8.0, 4.0),
..Default::default()
});
Expand Down
4 changes: 2 additions & 2 deletions examples/scroll.rs
Expand Up @@ -17,7 +17,7 @@ enum ScrollType {
}

fn main() {
App::build()
App::new()
.insert_resource(Msaa { samples: 4 })
.add_plugins(DefaultPlugins)
//NoCameraPlayerPlugin as we provide the camera
Expand Down Expand Up @@ -53,7 +53,7 @@ fn setup(
..Default::default()
});
// light
commands.spawn_bundle(LightBundle {
commands.spawn_bundle(PointLightBundle {
transform: Transform::from_xyz(4.0, 8.0, 4.0),
..Default::default()
});
Expand Down
23 changes: 12 additions & 11 deletions src/lib.rs
Expand Up @@ -26,6 +26,7 @@ impl Default for MovementSettings {
}

/// Used in queries when you want flycams and not other cameras
#[derive(Component)]
pub struct FlyCam;

/// Grabs/ungrabs mouse cursor
Expand Down Expand Up @@ -122,26 +123,26 @@ fn cursor_grab(keys: Res<Input<KeyCode>>, mut windows: ResMut<Windows>) {
/// Contains everything needed to add first-person fly camera behavior to your game
pub struct PlayerPlugin;
impl Plugin for PlayerPlugin {
fn build(&self, app: &mut AppBuilder) {
fn build(&self, app: &mut App) {
app.init_resource::<InputState>()
.init_resource::<MovementSettings>()
.add_startup_system(setup_player.system())
.add_startup_system(initial_grab_cursor.system())
.add_system(player_move.system())
.add_system(player_look.system())
.add_system(cursor_grab.system());
.add_startup_system(setup_player)
.add_startup_system(initial_grab_cursor)
.add_system(player_move)
.add_system(player_look)
.add_system(cursor_grab);
}
}

/// Same as `PlayerPlugin` but does not spawn a camera
pub struct NoCameraPlayerPlugin;
impl Plugin for NoCameraPlayerPlugin {
fn build(&self, app: &mut AppBuilder) {
fn build(&self, app: &mut App) {
app.init_resource::<InputState>()
.init_resource::<MovementSettings>()
.add_startup_system(initial_grab_cursor.system())
.add_system(player_move.system())
.add_system(player_look.system())
.add_system(cursor_grab.system());
.add_startup_system(initial_grab_cursor)
.add_system(player_move)
.add_system(player_look)
.add_system(cursor_grab);
}
}