chore: Upgrade to Bevy 0.14.
All checks were successful
Test / test (ubuntu-latest) (push) Successful in 2m8s
All checks were successful
Test / test (ubuntu-latest) (push) Successful in 2m8s
This commit is contained in:
parent
6cf5d92cb8
commit
7cef2fedd5
|
@ -33,7 +33,7 @@ jobs:
|
||||||
if: runner.os == 'linux'
|
if: runner.os == 'linux'
|
||||||
- uses: actions/setup-python@v3
|
- uses: actions/setup-python@v3
|
||||||
- uses: pre-commit/action@v3.0.1
|
- uses: pre-commit/action@v3.0.1
|
||||||
- ame: Publish
|
- name: Publish
|
||||||
run: cargo publish
|
run: cargo publish
|
||||||
env:
|
env:
|
||||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||||
|
|
|
@ -10,11 +10,12 @@ repository = "https://labs.lightsout.games/projects/bevy_synthizer"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy = { version = "0.13", default-features = false, features = ["bevy_asset"] }
|
bevy = { version = "0.14", default-features = false, features = ["bevy_asset"] }
|
||||||
synthizer = "0.5.6"
|
synthizer = "0.5.6"
|
||||||
|
thiserror = "1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
bevy = { version = "0.13", default-features = true }
|
bevy = { version = "0.14", default-features = true }
|
||||||
|
|
||||||
[package.metadata.release]
|
[package.metadata.release]
|
||||||
publish = false
|
publish = false
|
||||||
|
|
|
@ -51,7 +51,7 @@ fn load_and_create(
|
||||||
fn rotate_listener(time: Res<Time>, mut query: Query<(&mut RotationTimer, &mut Transform)>) {
|
fn rotate_listener(time: Res<Time>, mut query: Query<(&mut RotationTimer, &mut Transform)>) {
|
||||||
for (mut timer, mut transform) in query.iter_mut() {
|
for (mut timer, mut transform) in query.iter_mut() {
|
||||||
timer.tick(time.delta());
|
timer.tick(time.delta());
|
||||||
let angle = f32::consts::PI * 2. * timer.percent();
|
let angle = f32::consts::PI * 2. * timer.fraction();
|
||||||
transform.rotation = Quat::from_rotation_z(angle);
|
transform.rotation = Quat::from_rotation_z(angle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,9 +68,6 @@ fn main() {
|
||||||
))
|
))
|
||||||
.init_resource::<AssetHandles>()
|
.init_resource::<AssetHandles>()
|
||||||
.add_systems(Startup, setup)
|
.add_systems(Startup, setup)
|
||||||
.add_systems(
|
.add_systems(Update, (load_and_create, rotate_listener))
|
||||||
Update,
|
|
||||||
(bevy::window::close_on_esc, load_and_create, rotate_listener),
|
|
||||||
)
|
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ fn setup(mut commands: Commands, context: Res<Context>) {
|
||||||
fn rotate_listener(time: Res<Time>, mut query: Query<(&mut RotationTimer, &mut Transform)>) {
|
fn rotate_listener(time: Res<Time>, mut query: Query<(&mut RotationTimer, &mut Transform)>) {
|
||||||
for (mut timer, mut transform) in query.iter_mut() {
|
for (mut timer, mut transform) in query.iter_mut() {
|
||||||
timer.tick(time.delta());
|
timer.tick(time.delta());
|
||||||
let angle = f32::consts::PI * 2. * timer.percent();
|
let angle = f32::consts::PI * 2. * timer.fraction();
|
||||||
transform.rotation = Quat::from_rotation_z(angle);
|
transform.rotation = Quat::from_rotation_z(angle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,6 @@ fn main() {
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
.add_systems(Startup, setup)
|
.add_systems(Startup, setup)
|
||||||
.add_systems(Update, (bevy::window::close_on_esc, rotate_listener))
|
.add_systems(Update, rotate_listener)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
27
src/lib.rs
27
src/lib.rs
|
@ -6,12 +6,9 @@ use bevy::{
|
||||||
prelude::*,
|
prelude::*,
|
||||||
reflect::TypePath,
|
reflect::TypePath,
|
||||||
transform::TransformSystem,
|
transform::TransformSystem,
|
||||||
utils::{
|
|
||||||
thiserror::{self, Error},
|
|
||||||
BoxedFuture,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
pub use synthizer as syz;
|
pub use synthizer as syz;
|
||||||
|
use thiserror::Error;
|
||||||
|
|
||||||
#[derive(Asset, Clone, Debug, Deref, DerefMut, PartialEq, Eq, TypePath)]
|
#[derive(Asset, Clone, Debug, Deref, DerefMut, PartialEq, Eq, TypePath)]
|
||||||
pub struct Buffer(syz::Buffer);
|
pub struct Buffer(syz::Buffer);
|
||||||
|
@ -33,18 +30,16 @@ impl AssetLoader for BufferAssetLoader {
|
||||||
type Settings = ();
|
type Settings = ();
|
||||||
type Error = BufferAssetLoaderError;
|
type Error = BufferAssetLoaderError;
|
||||||
|
|
||||||
fn load<'a>(
|
async fn load<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
reader: &'a mut Reader,
|
reader: &'a mut Reader<'_>,
|
||||||
_settings: &'a (),
|
_settings: &'a (),
|
||||||
_load_context: &'a mut LoadContext,
|
_load_context: &'a mut LoadContext<'_>,
|
||||||
) -> BoxedFuture<'a, Result<Self::Asset, Self::Error>> {
|
) -> Result<Self::Asset, Self::Error> {
|
||||||
Box::pin(async move {
|
let mut bytes = Vec::new();
|
||||||
let mut bytes = Vec::new();
|
reader.read_to_end(&mut bytes).await?;
|
||||||
reader.read_to_end(&mut bytes).await?;
|
let buffer = syz::Buffer::from_encoded_data(&bytes).map(Buffer)?;
|
||||||
let buffer = syz::Buffer::from_encoded_data(&bytes).map(Buffer)?;
|
Ok(buffer)
|
||||||
Ok(buffer)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn extensions(&self) -> &[&str] {
|
fn extensions(&self) -> &[&str] {
|
||||||
|
@ -707,10 +702,10 @@ pub struct SynthizerPlugin {
|
||||||
|
|
||||||
impl Plugin for SynthizerPlugin {
|
impl Plugin for SynthizerPlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
if !app.world.contains_resource::<SynthizerPlugin>() {
|
if !app.world().contains_resource::<SynthizerPlugin>() {
|
||||||
app.insert_resource(*self);
|
app.insert_resource(*self);
|
||||||
}
|
}
|
||||||
let config = *app.world.get_resource::<SynthizerPlugin>().unwrap();
|
let config = *app.world().get_resource::<SynthizerPlugin>().unwrap();
|
||||||
let mut syz_config = syz::LibraryConfig::new();
|
let mut syz_config = syz::LibraryConfig::new();
|
||||||
syz_config.log_level(config.log_level);
|
syz_config.log_level(config.log_level);
|
||||||
if config.log_to_stderr {
|
if config.log_to_stderr {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user