Skip to content

Commit

Permalink
Clean up examples and bump version to 0.18
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasEi committed Nov 8, 2023
1 parent ea40892 commit b372b97
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 24 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Changelog

## v0.18.0 - 08.11.2023
- update to Bevy 0.12
- Make `loading_state::LoadingStateSet` public for explicit system ordering
- Support configuring an image sampler through a derive attribute ([#156](https://github.com/NiklasEi/bevy_asset_loader/pull/156))
- See [the new example](bevy_asset_loader/examples/image_asset.rs)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,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 process is observed. Only when asset collections can be build with fully loaded asset handles, the collections are inserted 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.11` (see [version table](#compatible-bevy-versions))_
_The `main` branch and the latest release support Bevy version `0.12` (see [version table](#compatible-bevy-versions))_

## Loading states

Expand Down
8 changes: 4 additions & 4 deletions bevy_asset_loader/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_asset_loader"
version = "0.17.0"
version = "0.18.0"
authors = ["Niklas Eicker <git@nikl.me>"]
edition = "2021"
license = "MIT OR Apache-2.0"
Expand All @@ -22,18 +22,18 @@ progress_tracking = ["dep:iyes_progress"]

[dependencies]
bevy = { version = "0.12", default-features = false, features = ["bevy_asset"] }
bevy_asset_loader_derive = { version = "=0.17.0", path = "../bevy_asset_loader_derive" }
bevy_asset_loader_derive = { version = "=0.18.0", path = "../bevy_asset_loader_derive" }
anyhow = "1"
path-slash = "0.2"

bevy_common_assets = { version = "0.8.0", features = ["ron"], optional = true }
serde = { version = "1", optional = true }
iyes_progress = { git = "https://github.com/NiklasEi/iyes_progress", branch = "bevy_main", optional = true }
iyes_progress = { version = "0.10", optional = true }

[dev-dependencies]
bevy = { version = "0.12", features = ["vorbis"] }
anyhow = "1"
iyes_progress = { git = "https://github.com/NiklasEi/iyes_progress", branch = "bevy_main" }
iyes_progress = { version = "0.10" }
bevy_common_assets = { version = "0.8.0", features = ["ron"] }
serde = { version = "1" }
trybuild = { version = "1.0" }
Expand Down
2 changes: 1 addition & 1 deletion bevy_asset_loader/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ with `cargo run --example <example>`.
| [`failure_state.rs`](failure_state.rs) | Sets up a failure state |
| [`full_collection.rs`](full_collection.rs) | A complete asset collection with all supported non-dynamic field types |
| [`full_dynamic_collection.rs`](full_dynamic_collection.rs) | A complete asset collection with all supported dynamic asset field types |
| [`image_asset.rs`](image_asset.rs) | How to set different samplers for image assets |
| [`init_resource.rs`](init_resource.rs) | Inserting a `FromWorld` resource when all asset collections are loaded |
| [`manual_dynamic_asset.rs`](manual_dynamic_asset.rs) | Load an image asset from a path resolved at run time |
| [`no_loading_state.rs`](no_loading_state.rs) | How to use asset collections without a loading state |
| [`progress_tracking.rs`](progress_tracking.rs) | How to set up progress tracking using `iyes_progress` |
| [`standard_material.rs`](standard_material.rs) | Loading a standard material from a png file |
| [`two_collections.rs`](two_collections.rs) | Load multiple asset collections |
| [`image_asset.rs`](image_asset.rs) | How to set different samplers for image assets |

## Credits

Expand Down
1 change: 0 additions & 1 deletion bevy_asset_loader/examples/atlas_from_grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ fn main() {
LoadingState::new(MyStates::AssetLoading).continue_to_state(MyStates::Next),
)
.add_collection_to_loading_state::<_, MyAssets>(MyStates::AssetLoading)
.insert_resource(Msaa::Off)
.add_systems(OnEnter(MyStates::Next), draw_atlas)
.add_systems(
Update,
Expand Down
1 change: 0 additions & 1 deletion bevy_asset_loader/examples/custom_dynamic_assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use bevy_common_assets::ron::RonAssetPlugin;

fn main() {
App::new()
.insert_resource(Msaa::Off)
.add_plugins((
DefaultPlugins,
RonAssetPlugin::<CustomDynamicAssetCollection>::new(&["my-assets.ron"]),
Expand Down
1 change: 0 additions & 1 deletion bevy_asset_loader/examples/dynamic_asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ fn main() {
)
.add_collection_to_loading_state::<_, ImageAssets>(MyStates::AssetLoading)
.add_collection_to_loading_state::<_, AudioAssets>(MyStates::AssetLoading)
.insert_resource(Msaa::Off)
.add_systems(
OnEnter(MyStates::Next),
(spawn_player_and_tree, play_background_audio),
Expand Down
1 change: 0 additions & 1 deletion bevy_asset_loader/examples/image_asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ fn main() {
LoadingState::new(MyStates::AssetLoading).continue_to_state(MyStates::Next),
)
.add_collection_to_loading_state::<_, ImageAssets>(MyStates::AssetLoading)
.insert_resource(Msaa::Off)
.add_systems(OnEnter(MyStates::Next), draw)
.run();
}
Expand Down
1 change: 0 additions & 1 deletion bevy_asset_loader/examples/init_resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ fn main() {
)
.add_collection_to_loading_state::<_, ImageAssets>(MyStates::AssetLoading)
.init_resource_after_loading_state::<_, CombinedImage>(MyStates::AssetLoading)
.insert_resource(Msaa::Off)
.add_systems(OnEnter(MyStates::Next), draw)
.run();
}
Expand Down
1 change: 0 additions & 1 deletion bevy_asset_loader/examples/manual_dynamic_asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ fn main() {
LoadingState::new(MyStates::MenuAssetLoading).continue_to_state(MyStates::Menu),
)
.add_collection_to_loading_state::<_, FontAssets>(MyStates::MenuAssetLoading)
.insert_resource(Msaa::Off)
.insert_resource(ShowBackground(false))
.add_systems(
OnEnter(MyStates::Next),
Expand Down
1 change: 0 additions & 1 deletion bevy_asset_loader/examples/no_loading_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use bevy_asset_loader::prelude::*;
/// `AudioAssets` are initialised on the world based on user input (mouse click).
fn main() {
App::new()
.insert_resource(Msaa::Off)
.add_plugins(DefaultPlugins)
// Initialising the asset collection on the App:
// The assets will start loading as soon as your application fires up.
Expand Down
1 change: 0 additions & 1 deletion bevy_asset_loader/examples/standard_material.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ fn main() {
LoadingState::new(MyStates::AssetLoading).continue_to_state(MyStates::Next),
)
.add_collection_to_loading_state::<_, MyAssets>(MyStates::AssetLoading)
.insert_resource(Msaa::Off)
.insert_resource(AmbientLight {
color: Color::WHITE,
brightness: 0.2,
Expand Down
1 change: 0 additions & 1 deletion bevy_asset_loader/examples/two_collections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ fn main() {
)
.add_collection_to_loading_state::<_, ImageAssets>(MyStates::AssetLoading)
.add_collection_to_loading_state::<_, AudioAssets>(MyStates::AssetLoading)
.insert_resource(Msaa::Off)
.add_systems(
OnEnter(MyStates::Next),
(spawn_player_and_tree, play_background_audio),
Expand Down
15 changes: 7 additions & 8 deletions bevy_asset_loader/src/standard_dynamic_asset.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
use crate::dynamic_asset::{DynamicAsset, DynamicAssetType};
use crate::dynamic_asset::{DynamicAssetCollection, DynamicAssets};
use bevy::asset::{Asset, AssetServer, Assets, LoadedFolder, UntypedHandle};
use bevy::ecs::system::Command;
use bevy::ecs::world::World;
use bevy::reflect::TypePath;
use bevy::utils::HashMap;
use serde::Deserialize;

#[cfg(feature = "2d")]
use bevy::math::Vec2;
#[cfg(feature = "3d")]
use bevy::pbr::StandardMaterial;
#[cfg(any(feature = "2d", feature = "3d"))]
use bevy::render::texture::Image;
#[cfg(feature = "2d")]
use bevy::sprite::TextureAtlas;

use crate::dynamic_asset::{DynamicAssetCollection, DynamicAssets};
use bevy::reflect::TypePath;
#[cfg(any(feature = "3d", feature = "2d"))]
use bevy::render::texture::ImageSampler;
use bevy::render::texture::{Image, ImageSampler, ImageSamplerDescriptor};
#[cfg(any(feature = "3d", feature = "2d"))]
use bevy::render::texture::ImageSamplerDescriptor;
use bevy::utils::HashMap;
use serde::{Deserialize, Deserializer};
use serde::Deserializer;

/// These asset variants can be loaded from configuration files. They will then replace
/// a dynamic asset based on their keys.
Expand Down
2 changes: 1 addition & 1 deletion bevy_asset_loader_derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_asset_loader_derive"
version = "0.17.0"
version = "0.18.0"
authors = ["Niklas Eicker <git@nikl.me>"]
edition = "2021"
license = "MIT OR Apache-2.0"
Expand Down

0 comments on commit b372b97

Please sign in to comment.