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

Update to Bevy 0.7.0 #11

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Update to Bevy 0.7.0 #11

wants to merge 5 commits into from

Conversation

thmsgntz
Copy link

@thmsgntz thmsgntz commented Jun 21, 2022

Hi all!
I followed the tutorial to learn both Rust and Bevy. I did in Bevy 0.7.0 and bevy_mod_picking 0.6.1 (here is my repo, I did the migration from Bevy 0.4.0 from the tutorial page to 0.7.0. Was harder for me than doing it from 0.5.0!).
After I posted it on reddit, we advised me to do a Pull Request in your repo. So here it is!

Minor updates

Added component attributes

Since Bevy 0.6.0, all components structs require #[derive(Component)].

Remove the call of system() in the App setup

Since Bevy 0.7.0, .system is depreciated.

main.rs

Camera

Update: no modification on Camera.

Lights

PointLightBundle {
    transform: Transform::from_translation(Vec3::new(4.0, 8.0, 4.0)),
    ..Default::default()
}

ui.rs

Use TextBundle instead of NodeBundle with child:

.commands()
    .spawn_bundle(TextBundle {
            style: Style {
                position_type: PositionType::Absolute,
                position: Rect {
                    left: Val::Px(10.),
                    top: Val::Px(10.),
                    ..Default::default()
                },
                ..Default::default()
                },
            text: Text::with_section(
                String::from("Next move: White"),
                TextStyle {
                        font: font.clone(),
                        font_size: 40.0,
                        color: Color::rgb(0.8, 0.8, 0.8),
                        },
            TextAlignment {
                        horizontal: HorizontalAlign::Center,
                        ..default()
                    }),
            ..Default::default()
            })
            .insert(NextMoveText);

@alice-i-cecile
Copy link

Nice! Only change that I'm questioning is the swap to an orthographic camera. This will look different than the original camera, although I think both choices are defensible for chess.

@thmsgntz
Copy link
Author

Now that you mention it, I don't know! The camera was the first component that I added in my learning process in Bevy, so I think what happened is that I didn't manage to make PerspectiveCameraBundle work. Then I ran in this example and thought "oh this is how we do now in 0.7.0".

But now that I see that PerspectiveCameraBundle perfectly exists in 0.7.0.. I think I can switch back to PerspectiveCameraBundle so we keep the changes minimal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants