Skip to content

Commit

Permalink
Merge pull request #2 from snorrwe/main
Browse files Browse the repository at this point in the history
Support Bevy 0.6
  • Loading branch information
hanabi1224 authored Jan 12, 2022
2 parents b3ca8e6 + 4b712b6 commit ddcc5b9
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 30 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_assets_bundler"
version = "0.1.0"
version = "0.2.0"

description = "Assets Bundler for bevy, with content encryption support."

Expand Down Expand Up @@ -36,7 +36,7 @@ encryption = ["aes", "block-modes"]

[dependencies]
# https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#tilde-requirements
bevy = {version = "~0.5", default-features = false}
bevy = {version = "~0.6", default-features = false}

anyhow = "1"
bs58 = "0.4"
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Assets Bundler for bevy, with content encryption support. Current archive format
```toml
# Cargo.toml
[dependencies]
bevy = "0.5"
bevy = "0.6"
bevy_assets_bundler = "0.1"

[build-dependencies]
Expand All @@ -31,7 +31,7 @@ bevy_assets_bundler = "0.1"
<!-- ```toml
# Cargo.toml
[dependencies]
bevy = "0.5"
bevy = "0.6"
bevy_assets_bundler = {git = "https://github.com/hanabi1224/bevy_assets_bundler"}
[build-dependencies]
Expand Down Expand Up @@ -70,7 +70,7 @@ fn main() {
options.encode_file_names = true;
options.enabled_on_debug_build = true;

App::build()
App::new()
.add_plugins_with(DefaultPlugins, |group| {
group.add_before::<AssetPlugin, _>(BundledAssetIoPlugin::from(
options.clone(),
Expand Down Expand Up @@ -107,6 +107,7 @@ pub struct AssetBundlingOptions {
|bevy|bevy_assets_bundler|
|---|---|
|0.5|0.1|
|0.6|0.2|

## Examples

Expand Down
2 changes: 1 addition & 1 deletion example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ resolver = "2"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bevy = "0.5"
bevy = "0.6"
futures-lite = "1"
lazy_static = "1"
rand = "0"
Expand Down
37 changes: 16 additions & 21 deletions example/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn main() {
println!("cwd: {:?}", env::current_dir());
let mut log_setting = LogSettings::default();
log_setting.level = Level::INFO;
App::build()
App::new()
.insert_resource(log_setting)
.add_plugins_with(DefaultPlugins, |group| {
// the custom asset io plugin must be inserted in-between the
Expand All @@ -28,11 +28,7 @@ fn main() {
.run();
}

fn setup(
mut commands: Commands,
asset_server: Res<AssetServer>,
mut materials: ResMut<Assets<ColorMaterial>>,
) {
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
// ui camera
commands.spawn_bundle(UiCameraBundle::default());
// root node
Expand All @@ -43,7 +39,7 @@ fn setup(
justify_content: JustifyContent::SpaceBetween,
..Default::default()
},
material: materials.add(Color::NONE.into()),
color: Color::NONE.into(),
..Default::default()
})
.with_children(|parent| {
Expand All @@ -55,7 +51,7 @@ fn setup(
border: Rect::all(Val::Px(2.0)),
..Default::default()
},
material: materials.add(Color::rgb(0.65, 0.65, 0.65).into()),
color: Color::rgb(0.65, 0.65, 0.65).into(),
..Default::default()
})
.with_children(|parent| {
Expand All @@ -67,7 +63,7 @@ fn setup(
align_items: AlignItems::FlexEnd,
..Default::default()
},
material: materials.add(Color::rgb(0.15, 0.15, 0.15).into()),
color: Color::rgb(0.15, 0.15, 0.15).into(),
..Default::default()
})
.with_children(|parent| {
Expand Down Expand Up @@ -96,7 +92,7 @@ fn setup(
size: Size::new(Val::Px(200.0), Val::Percent(100.0)),
..Default::default()
},
material: materials.add(Color::rgb(0.15, 0.15, 0.15).into()),
color: Color::rgb(0.15, 0.15, 0.15).into(),
..Default::default()
});
// absolute positioning
Expand All @@ -113,7 +109,7 @@ fn setup(
border: Rect::all(Val::Px(20.0)),
..Default::default()
},
material: materials.add(Color::rgb(0.4, 0.4, 1.0).into()),
color: Color::rgb(0.4, 0.4, 1.0).into(),
..Default::default()
})
.with_children(|parent| {
Expand All @@ -122,7 +118,7 @@ fn setup(
size: Size::new(Val::Percent(100.0), Val::Percent(100.0)),
..Default::default()
},
material: materials.add(Color::rgb(0.8, 0.8, 1.0).into()),
color: Color::rgb(0.8, 0.8, 1.0).into(),
..Default::default()
});
});
Expand All @@ -136,7 +132,7 @@ fn setup(
justify_content: JustifyContent::Center,
..Default::default()
},
material: materials.add(Color::NONE.into()),
color: Color::NONE.into(),
..Default::default()
})
.with_children(|parent| {
Expand All @@ -146,7 +142,7 @@ fn setup(
size: Size::new(Val::Px(100.0), Val::Px(100.0)),
..Default::default()
},
material: materials.add(Color::rgb(1.0, 0.0, 0.0).into()),
color: Color::rgb(1.0, 0.0, 0.0).into(),
..Default::default()
})
.with_children(|parent| {
Expand All @@ -161,7 +157,7 @@ fn setup(
},
..Default::default()
},
material: materials.add(Color::rgb(1.0, 0.3, 0.3).into()),
color: Color::rgb(1.0, 0.3, 0.3).into(),
..Default::default()
});
parent.spawn_bundle(NodeBundle {
Expand All @@ -175,7 +171,7 @@ fn setup(
},
..Default::default()
},
material: materials.add(Color::rgb(1.0, 0.5, 0.5).into()),
color: Color::rgb(1.0, 0.5, 0.5).into(),
..Default::default()
});
parent.spawn_bundle(NodeBundle {
Expand All @@ -189,7 +185,7 @@ fn setup(
},
..Default::default()
},
material: materials.add(Color::rgb(1.0, 0.7, 0.7).into()),
color: Color::rgb(1.0, 0.7, 0.7).into(),
..Default::default()
});
// alpha test
Expand All @@ -204,7 +200,7 @@ fn setup(
},
..Default::default()
},
material: materials.add(Color::rgba(1.0, 0.9, 0.9, 0.4).into()),
color: Color::rgba(1.0, 0.9, 0.9, 0.4).into(),
..Default::default()
});
});
Expand All @@ -219,7 +215,7 @@ fn setup(
align_items: AlignItems::FlexEnd,
..Default::default()
},
material: materials.add(Color::NONE.into()),
color: Color::NONE.into(),
..Default::default()
})
.with_children(|parent| {
Expand All @@ -229,8 +225,7 @@ fn setup(
size: Size::new(Val::Px(500.0), Val::Auto),
..Default::default()
},
material: materials
.add(asset_server.load("branding/bevy_logo_dark_big.png").into()),
image: asset_server.load("branding/bevy_logo_dark_big.png").into(),
..Default::default()
});
});
Expand Down
6 changes: 3 additions & 3 deletions src/plugin/bundled_asset_plugin.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::BundledAssetIo;
use crate::AssetBundlingOptions;
use bevy::{
app::{AppBuilder, Plugin},
app::{App, Plugin},
asset::AssetServer,
tasks::IoTaskPool,
};
Expand All @@ -25,7 +25,7 @@ impl From<AssetBundlingOptions> for BundledAssetIoPlugin {
}

impl Plugin for BundledAssetIoPlugin {
fn build(&self, app: &mut AppBuilder) {
fn build(&self, app: &mut App) {
cfg_if::cfg_if! {
if #[cfg(debug_assertions)]{
if !self.options.enabled_on_debug_build {
Expand All @@ -35,7 +35,7 @@ impl Plugin for BundledAssetIoPlugin {
}
}
let task_pool = app
.world()
.world
.get_resource::<IoTaskPool>()
.expect("`IoTaskPool` resource not found.")
.0
Expand Down

0 comments on commit ddcc5b9

Please sign in to comment.