Skip to content

Commit

Permalink
Update to Bevy 0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasEi committed Jul 10, 2023
1 parent abe450a commit 2849037
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 35 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## v0.7.0 - 10.07.2023
- Update to Bevy 0.11

## v0.6.0 - 18.03.2023
- Support for xml assets

Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_common_assets"
version = "0.7.0-dev"
version = "0.7.0"
authors = ["Niklas Eicker <git@nikl.me>"]
edition = "2021"
license = "MIT OR Apache-2.0"
Expand All @@ -21,18 +21,18 @@ msgpack = ["dep:rmp-serde"]
xml = ["dep:quick-xml"]

[dependencies]
bevy = { git = "https://github.com/bevyengine/bevy", default-features = false, features = ["bevy_asset"] }
bevy = { version = "0.11", default-features = false, features = ["bevy_asset"] }
serde_toml = { version = "0.7", package = "toml", optional = true }
serde_ron = { version = "0.8", package = "ron", optional = true }
serde_yaml = { version = "0.9", optional = true }
serde_json = { version = "1", optional = true }
rmp-serde = { version = "1", optional = true }
quick-xml = { version = "0.28.0", features = [ "serialize" ], optional = true }
quick-xml = { version = "0.29", features = [ "serialize" ], optional = true }
serde = { version = "1" }
anyhow = { version = "1" }

[dev-dependencies]
bevy = { git = "https://github.com/bevyengine/bevy" }
bevy = { version = "0.11" }
serde = { version = "1" }

[package.metadata.docs.rs]
Expand Down
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Supported formats:

Enable the feature(s) for the format(s) that you want to use.

Define the types that you would like to load from files and derive `serde::Deserialize` and `bevy::reflect::TypeUuid` for them. The latter requires a unique uuid as an attribute:
Define the types that you would like to load from files and derive `serde::Deserialize`, `bevy::reflect::TypePath`, and `bevy::reflect::TypeUuid` for them. The last derive requires a unique uuid as an attribute:
```rust
#[derive(serde::Deserialize, bevy::reflect::TypeUuid, bevy::reflect::TypePath)]
#[uuid = "413be529-bfeb-41b3-9db0-4b8b380a2c46"] // <-- keep me unique
Expand All @@ -44,13 +44,15 @@ use bevy_common_assets::yaml::YamlAssetPlugin;

fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(JsonAssetPlugin::<Level>::new(&["level.json", "custom.json"]))
.add_plugin(RonAssetPlugin::<Level>::new(&["level.ron"]))
.add_plugin(MsgPackAssetPlugin::<Level>::new(&["level.msgpack"]))
.add_plugin(TomlAssetPlugin::<Level>::new(&["level.toml"]))
.add_plugin(XmlAssetPlugin::<Level>::new(&["level.xml"]))
.add_plugin(YamlAssetPlugin::<Level>::new(&["level.yaml"]))
.add_plugins((
DefaultPlugins,
JsonAssetPlugin::<Level>::new(&["level.json", "custom.json"]),
RonAssetPlugin::<Level>::new(&["level.ron"]),
MsgPackAssetPlugin::<Level>::new(&["level.msgpack"]),
TomlAssetPlugin::<Level>::new(&["level.toml"]),
XmlAssetPlugin::<Level>::new(&["level.xml"]),
YamlAssetPlugin::<Level>::new(&["level.yaml"])
))
// ...
.run();
}
Expand All @@ -75,6 +77,7 @@ Compatibility of `bevy_common_assets` versions:

| `bevy_common_assets` | `bevy` |
|:---------------------|:-------|
| `0.7` | `0.11` |
| `0.5` - `0.6` | `0.10` |
| `0.4` | `0.9` |
| `0.3` | `0.8` |
Expand Down
6 changes: 4 additions & 2 deletions examples/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ use bevy_common_assets::json::JsonAssetPlugin;

fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(JsonAssetPlugin::<Level>::new(&["level.json"]))
.add_plugins((
DefaultPlugins,
JsonAssetPlugin::<Level>::new(&["level.json"]),
))
.insert_resource(Msaa::Off)
.add_state::<AppState>()
.add_systems(Startup, setup)
Expand Down
6 changes: 4 additions & 2 deletions examples/msgpack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ use bevy_common_assets::msgpack::MsgPackAssetPlugin;

fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(MsgPackAssetPlugin::<Level>::new(&["level.msgpack"]))
.add_plugins((
DefaultPlugins,
MsgPackAssetPlugin::<Level>::new(&["level.msgpack"]),
))
.insert_resource(Msaa::Off)
.add_state::<AppState>()
.add_systems(Startup, setup)
Expand Down
8 changes: 5 additions & 3 deletions examples/multiple_formats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ use bevy_common_assets::ron::RonAssetPlugin;

fn main() {
App::new()
.add_plugins(DefaultPlugins)
// You can add loaders for different asset types, but also multiple loaders for the same asset type
// The important thing is: they all need distinct extensions!
.add_plugin(JsonAssetPlugin::<Level>::new(&["level.json"]))
.add_plugin(RonAssetPlugin::<Level>::new(&["level.ron"]))
.add_plugins((
DefaultPlugins,
RonAssetPlugin::<Level>::new(&["level.ron"]),
JsonAssetPlugin::<Level>::new(&["level.json"]),
))
.insert_resource(Msaa::Off)
.add_state::<AppState>()
.add_systems(Startup, setup)
Expand Down
3 changes: 1 addition & 2 deletions examples/ron.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use bevy_common_assets::ron::RonAssetPlugin;

fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(RonAssetPlugin::<Level>::new(&["level.ron"]))
.add_plugins((DefaultPlugins, RonAssetPlugin::<Level>::new(&["level.ron"])))
.insert_resource(Msaa::Off)
.add_state::<AppState>()
.add_systems(Startup, setup)
Expand Down
6 changes: 4 additions & 2 deletions examples/toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ use bevy_common_assets::toml::TomlAssetPlugin;

fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(TomlAssetPlugin::<Level>::new(&["level.toml"]))
.add_plugins((
DefaultPlugins,
TomlAssetPlugin::<Level>::new(&["level.toml"]),
))
.insert_resource(Msaa::Off)
.add_state::<AppState>()
.add_systems(Startup, setup)
Expand Down
3 changes: 1 addition & 2 deletions examples/xml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ use bevy_common_assets::xml::XmlAssetPlugin;

fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(XmlAssetPlugin::<Level>::new(&["level.xml"]))
.add_plugins((DefaultPlugins, XmlAssetPlugin::<Level>::new(&["level.xml"])))
.insert_resource(Msaa::Off)
.add_state::<AppState>()
.add_systems(Startup, setup)
Expand Down
6 changes: 4 additions & 2 deletions examples/yaml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ use bevy_common_assets::yaml::YamlAssetPlugin;

fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(YamlAssetPlugin::<Level>::new(&["level.yaml"]))
.add_plugins((
DefaultPlugins,
YamlAssetPlugin::<Level>::new(&["level.yaml"]),
))
.insert_resource(Msaa::Off)
.add_state::<AppState>()
.add_systems(Startup, setup)
Expand Down
12 changes: 4 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,11 @@
//! fn main() {
//! App::new()
//! # /*
//! .add_plugins(DefaultPlugins)
//! .add_plugins((DefaultPlugins, JsonAssetPlugin::<Level>::new(&["level.json"])))
//! # */
//! # .add_plugins(MinimalPlugins)
//! # .add_plugin(AssetPlugin::default())
//! # /*
//! .add_plugin(JsonAssetPlugin::<Level>::new(&["level.json"]))
//! # */
//! .add_startup_system(load_level)
//! # .add_system(stop)
//! # .add_plugins((MinimalPlugins, AssetPlugin::default()))
//! .add_systems(Startup, load_level)
//! # .add_systems(Update, stop)
//! .run()
//! }
//!
Expand Down

0 comments on commit 2849037

Please sign in to comment.