-
Notifications
You must be signed in to change notification settings - Fork 108
bevy 0.15 #340
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
Merged
Merged
bevy 0.15 #340
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
0ff1749
WIP: moving towards bevy 0.15
alxgnon 1f7adbe
Fix dev-dependencies
neocturne df91826
Fix (rustc and clippy) warnings
neocturne 6a79869
Finish SpriteBundle -> Sprite migration
neocturne d19ac0a
Rename sprite_sheet_bundle to sprite_sheet, drop LdtkSpriteSheetBundle
neocturne bbb3031
examples: fix platformer example
neocturne 7d7a0bd
Add Visibility components where it is missing
neocturne a55b10c
Switch bevy_rapier2d to released version
neocturne 80e41b3
implement deref for LdtkProjectHandle
alxgnon 8262e46
use bevy_ecs_tilemap 0.15
alxgnon a70298a
update existing docs + add migration guide
alxgnon 332d682
small improvements to the documentation
alxgnon 6baa937
improvements and fixes on the LdtkProjectHandle
alxgnon 357e85c
use rust,ignore in migration guides
alxgnon f6fce34
docs: add 0.11 migration guide to SUMMARY
Trouv e01861d
docs: update existing rapier config instead of spawning a new one in …
Trouv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
book/src/how-to-guides/migration-guides/migrate-from-0.10-to-0.11.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| # Migrate from 0.10 to 0.11 | ||
|
|
||
| ## Bevy upgrade | ||
| `bevy_ecs_ldtk` has upgraded to Bevy and `bevy_ecs_tilemap` version `0.15`. | ||
| A Bevy `0.15` migration guide is available on [Bevy's website](https://bevyengine.org/learn/migration-guides/0-14-to-0-15/). | ||
|
|
||
| ## `LdtkSpriteSheetBundle` replaced with `Sprite` | ||
| The use of `LdtkSpriteSheetBundle` has been replaced by a simple use of `Sprite`. The macro has changed as well, and is now named `#[sprite_sheet]`. | ||
alxgnon marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ```rust,ignore | ||
| // 0.10 | ||
| # use bevy_ecs_ldtk::prelude::*; | ||
| # use bevy::prelude::*; | ||
| #[derive(Default, Bundle, LdtkEntity)] | ||
| struct PlayerBundle { | ||
| #[sprite_sheet_bundle] | ||
| sprite_bundle: LdtkSpriteSheetBundle, | ||
| #[grid_coords] | ||
| grid_coords: GridCoords, | ||
| } | ||
| ``` | ||
| ```rust,no_run | ||
| // 0.11 | ||
| # use bevy_ecs_ldtk::prelude::*; | ||
| # use bevy::prelude::*; | ||
| #[derive(Default, Bundle, LdtkEntity)] | ||
| struct PlayerBundle { | ||
| #[sprite_sheet] | ||
| sprite_sheet: Sprite, | ||
| #[grid_coords] | ||
| grid_coords: GridCoords, | ||
| } | ||
| ``` | ||
|
|
||
| ## `SpriteBundle` also replaced with `Sprite` | ||
| When using a `SpriteBundle` with the `#[sprite_bundle]` macro, use a `Sprite` instead. The macro is now named `#[sprite]`. | ||
| ```rust,ignore | ||
| // 0.10 | ||
| # use bevy_ecs_ldtk::prelude::*; | ||
| # use bevy::prelude::*; | ||
| #[derive(Bundle, LdtkEntity, Default)] | ||
| pub struct Player { | ||
| player: PlayerComponent, | ||
| health: Health, | ||
| #[sprite_bundle] | ||
| sprite_bundle: SpriteBundle, | ||
| } | ||
| ``` | ||
| ```rust,no_run | ||
| // 0.11 | ||
| # use bevy_ecs_ldtk::prelude::*; | ||
| # use bevy::prelude::*; | ||
| #[derive(Bundle, LdtkEntity, Default)] | ||
| pub struct Player { | ||
| player: PlayerComponent, | ||
| health: Health, | ||
| #[sprite] | ||
| sprite: Sprite, | ||
| } | ||
| ``` | ||
|
|
||
| ## `Handle<LdtkProject>` replaced with `LdtkProjectHandle` | ||
| Handles cannot be used as components in Bevy `0.15` onward. This has two changes. | ||
| ### Call `.into()` when loading a project | ||
| First, you must call `.into()` when loading the world. | ||
| ```rust,ignore | ||
| // 0.10 | ||
| # use bevy_ecs_ldtk::prelude::*; | ||
| # use bevy::prelude::*; | ||
| fn setup(mut commands: Commands, asset_server: Res<AssetServer>) { | ||
| commands.spawn(LdtkWorldBundle { | ||
| ldtk_handle: asset_server.load("my_project.ldtk"), | ||
| ..Default::default() | ||
| }); | ||
| } | ||
| ``` | ||
| ```rust,no_run | ||
| // 0.11 | ||
| # use bevy_ecs_ldtk::prelude::*; | ||
| # use bevy::prelude::*; | ||
| fn setup(mut commands: Commands, asset_server: Res<AssetServer>) { | ||
| commands.spawn(LdtkWorldBundle { | ||
| ldtk_handle: asset_server.load("my_project.ldtk").into(), | ||
| ..Default::default() | ||
| }); | ||
| } | ||
| ``` | ||
| ### Replace usages of `Handle<LdtkProject>` | ||
| Second, uses of `Handle<LdtkProject>` in queries must be replaced with `LdtkProjectHandle`. It is enough to replace the type in the signature, as the `LdtkProjectHandle` type is a drop-in replacement for the handle. | ||
|
|
||
| ```rust,ignore | ||
| // 0.10 | ||
| # use bevy_ecs_ldtk::prelude::*; | ||
| # use bevy::prelude::*; | ||
| fn respawn_world( | ||
| mut commands: Commands, | ||
| ldtk_projects: Query<Entity, With<Handle<LdtkProject>>>, | ||
| input: Res<ButtonInput<KeyCode>>, | ||
| ) { | ||
| if input.just_pressed(KeyCode::KeyR) { | ||
| commands.entity(ldtk_projects.single()).insert(Respawn); | ||
| } | ||
| } | ||
| ``` | ||
| ```rust,no_run | ||
| // 0.11 | ||
| # use bevy_ecs_ldtk::prelude::*; | ||
| # use bevy::prelude::*; | ||
| fn respawn_world( | ||
| mut commands: Commands, | ||
| ldtk_projects: Query<Entity, With<LdtkProjectHandle>>, | ||
| input: Res<ButtonInput<KeyCode>>, | ||
| ) { | ||
| if input.just_pressed(KeyCode::KeyR) { | ||
| commands.entity(ldtk_projects.single()).insert(Respawn); | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.