diff --git a/CHANGELOG.md b/CHANGELOG.md index c7922eb..0e80879 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v0.22.0 - 01.12.2024 +- support for Bevy 0.15 +- support for using sub states as loading states ([@mgi388](https://github.com/mgi388) in [#239](https://github.com/NiklasEi/bevy_asset_loader/pull/239)) +- support image sampler address modes for image assets ([@pcwalton](https://github.com/pcwalton) in [#238](https://github.com/NiklasEi/bevy_asset_loader/pull/238)) - custom `on_unimplemented` diagnostics for the `AssetCollection` trait - image derive attribute `array_texture_layers` - wait for dependencies of assets to load diff --git a/README.md b/README.md index f745248..fc15cc7 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This [Bevy][bevy] plugin reduces boilerplate for handling game assets. The crate In most cases you will want to load your asset collections during loading states (think loading screens). During such a state, all assets are loaded and their loading progress is observed. Only when asset collections can be built with fully loaded asset handles, the collections are inserted to Bevy's ECS as resources. If you do not want to use a loading state, asset collections can still result in cleaner code and improved maintainability (see the ["usage without a loading state"](#usage-without-a-loading-state) section). -_The `main` branch and the latest release support Bevy version `0.14` (see [version table](#compatible-bevy-versions))_ +_The `main` branch and the latest release support Bevy version `0.15` (see [version table](#compatible-bevy-versions))_ ## Loading states @@ -45,10 +45,7 @@ struct AudioAssets { /// This system runs in MyStates::Next. Thus, AudioAssets is available as a resource /// and the contained handle is done loading. fn start_background_audio(mut commands: Commands, audio_assets: Res) { - commands.spawn(AudioBundle { - source: audio_assets.background.clone(), - settings: PlaybackSettings::LOOP, - }); + commands.spawn((AudioPlayer(audio_assets.background.clone()), PlaybackSettings::LOOP)); } #[derive(Clone, Eq, PartialEq, Debug, Hash, Default, States)] @@ -540,6 +537,7 @@ Compatibility of `bevy_asset_loader` versions: | Bevy version | `bevy_asset_loader` version | |:-------------|:----------------------------| +| `0.15` | `0.22` | | `0.14` | `0.21` | | `0.13` | `0.20` | | `0.12` | `0.18` - `0.19` | @@ -550,7 +548,7 @@ Compatibility of `bevy_asset_loader` versions: | `0.7` | `0.10` - `0.11` | | `0.6` | `0.8` - `0.9` | | `0.5` | `0.1` - `0.7` | -| `0.13` | branch `main` | +| `0.15` | branch `main` | | `main` | branch `bevy_main` | ## License diff --git a/bevy_asset_loader/Cargo.toml b/bevy_asset_loader/Cargo.toml index 7678bad..83dddd2 100644 --- a/bevy_asset_loader/Cargo.toml +++ b/bevy_asset_loader/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_asset_loader" -version = "0.21.0" +version = "0.22.0" authors = ["Niklas Eicker "] edition = "2021" license = "MIT OR Apache-2.0" @@ -15,27 +15,27 @@ readme = "README.md" [features] # This feature adds support for bevy's TextureAtlas assets -2d = ["bevy/bevy_sprite", "bevy_asset_loader_derive/2d"] +2d = ["bevy/bevy_sprite", "bevy/png", "bevy_asset_loader_derive/2d"] # This feature adds support for bevy's StandardMaterial assets -3d = ["bevy/bevy_pbr", "bevy_asset_loader_derive/3d"] +3d = ["bevy/bevy_pbr", "bevy/png", "bevy_asset_loader_derive/3d"] standard_dynamic_assets = ["dep:bevy_common_assets", "dep:serde"] progress_tracking = ["dep:iyes_progress"] [dependencies] -bevy = { version = "0.14.0", default-features = false, features = ["bevy_asset", "bevy_state"] } -bevy_asset_loader_derive = { version = "=0.21.0", path = "../bevy_asset_loader_derive" } +bevy = { version = "0.15.0", default-features = false, features = ["bevy_asset", "bevy_state"] } +bevy_asset_loader_derive = { version = "0.22.0", path = "../bevy_asset_loader_derive" } anyhow = "1" path-slash = "0.2" -bevy_common_assets = { version = "0.11.0", features = ["ron"], optional = true } +bevy_common_assets = { version = "0.12.0", features = ["ron"], optional = true } serde = { version = "1", optional = true } -iyes_progress = { version = "0.12.0", optional = true } +iyes_progress = { version = "0.13.0", optional = true } [dev-dependencies] -bevy = { version = "0.14.0", features = ["vorbis"] } +bevy = { version = "0.15.0", features = ["vorbis"] } anyhow = "1" -iyes_progress = { version = "0.12.0" } -bevy_common_assets = { version = "0.11.0", features = ["ron"] } +iyes_progress = { version = "0.13.0" } +bevy_common_assets = { version = "0.12.0", features = ["ron"] } serde = { version = "1" } ron = "0.8.1" trybuild = { version = "1.0" } diff --git a/bevy_asset_loader/examples/atlas_from_grid.rs b/bevy_asset_loader/examples/atlas_from_grid.rs index 366fc42..68f40d2 100644 --- a/bevy_asset_loader/examples/atlas_from_grid.rs +++ b/bevy_asset_loader/examples/atlas_from_grid.rs @@ -35,21 +35,19 @@ struct MyAssets { } fn draw_atlas(mut commands: Commands, my_assets: Res) { - commands.spawn(Camera2dBundle::default()); + commands.spawn(Camera2d); // draw the original image (whole sprite sheet) - commands.spawn(SpriteBundle { - texture: my_assets.female_adventurer.clone(), - transform: Transform::from_xyz(0., -150., 0.), - ..Default::default() - }); + commands.spawn(( + Sprite::from_image(my_assets.female_adventurer.clone()), + Transform::from_xyz(0., -150., 0.), + )); // draw animated sprite using the texture atlas layout commands.spawn(( - SpriteBundle { - texture: my_assets.female_adventurer.clone(), - transform: Transform::from_xyz(0., 150., 0.), - ..Default::default() - }, - TextureAtlas::from(my_assets.female_adventurer_layout.clone()), + Sprite::from_atlas_image( + my_assets.female_adventurer.clone(), + TextureAtlas::from(my_assets.female_adventurer_layout.clone()), + ), + Transform::from_xyz(0., 150., 0.), AnimationTimer(Timer::from_seconds(0.1, TimerMode::Repeating)), )); } @@ -57,14 +55,13 @@ fn draw_atlas(mut commands: Commands, my_assets: Res) { #[derive(Component)] struct AnimationTimer(Timer); -fn animate_sprite_system( - time: Res