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'
|
||||
- uses: actions/setup-python@v3
|
||||
- uses: pre-commit/action@v3.0.1
|
||||
- ame: Publish
|
||||
- name: Publish
|
||||
run: cargo publish
|
||||
env:
|
||||
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
|
||||
|
||||
[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"
|
||||
thiserror = "1"
|
||||
|
||||
[dev-dependencies]
|
||||
bevy = { version = "0.13", default-features = true }
|
||||
bevy = { version = "0.14", default-features = true }
|
||||
|
||||
[package.metadata.release]
|
||||
publish = false
|
||||
|
|
|
@ -51,7 +51,7 @@ fn load_and_create(
|
|||
fn rotate_listener(time: Res<Time>, mut query: Query<(&mut RotationTimer, &mut Transform)>) {
|
||||
for (mut timer, mut transform) in query.iter_mut() {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -68,9 +68,6 @@ fn main() {
|
|||
))
|
||||
.init_resource::<AssetHandles>()
|
||||
.add_systems(Startup, setup)
|
||||
.add_systems(
|
||||
Update,
|
||||
(bevy::window::close_on_esc, load_and_create, rotate_listener),
|
||||
)
|
||||
.add_systems(Update, (load_and_create, rotate_listener))
|
||||
.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)>) {
|
||||
for (mut timer, mut transform) in query.iter_mut() {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -51,6 +51,6 @@ fn main() {
|
|||
},
|
||||
))
|
||||
.add_systems(Startup, setup)
|
||||
.add_systems(Update, (bevy::window::close_on_esc, rotate_listener))
|
||||
.add_systems(Update, rotate_listener)
|
||||
.run();
|
||||
}
|
||||
|
|
27
src/lib.rs
27
src/lib.rs
|
@ -6,12 +6,9 @@ use bevy::{
|
|||
prelude::*,
|
||||
reflect::TypePath,
|
||||
transform::TransformSystem,
|
||||
utils::{
|
||||
thiserror::{self, Error},
|
||||
BoxedFuture,
|
||||
},
|
||||
};
|
||||
pub use synthizer as syz;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Asset, Clone, Debug, Deref, DerefMut, PartialEq, Eq, TypePath)]
|
||||
pub struct Buffer(syz::Buffer);
|
||||
|
@ -33,18 +30,16 @@ impl AssetLoader for BufferAssetLoader {
|
|||
type Settings = ();
|
||||
type Error = BufferAssetLoaderError;
|
||||
|
||||
fn load<'a>(
|
||||
async fn load<'a>(
|
||||
&'a self,
|
||||
reader: &'a mut Reader,
|
||||
reader: &'a mut Reader<'_>,
|
||||
_settings: &'a (),
|
||||
_load_context: &'a mut LoadContext,
|
||||
) -> BoxedFuture<'a, Result<Self::Asset, Self::Error>> {
|
||||
Box::pin(async move {
|
||||
let mut bytes = Vec::new();
|
||||
reader.read_to_end(&mut bytes).await?;
|
||||
let buffer = syz::Buffer::from_encoded_data(&bytes).map(Buffer)?;
|
||||
Ok(buffer)
|
||||
})
|
||||
_load_context: &'a mut LoadContext<'_>,
|
||||
) -> Result<Self::Asset, Self::Error> {
|
||||
let mut bytes = Vec::new();
|
||||
reader.read_to_end(&mut bytes).await?;
|
||||
let buffer = syz::Buffer::from_encoded_data(&bytes).map(Buffer)?;
|
||||
Ok(buffer)
|
||||
}
|
||||
|
||||
fn extensions(&self) -> &[&str] {
|
||||
|
@ -707,10 +702,10 @@ pub struct SynthizerPlugin {
|
|||
|
||||
impl Plugin for SynthizerPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
if !app.world.contains_resource::<SynthizerPlugin>() {
|
||||
if !app.world().contains_resource::<SynthizerPlugin>() {
|
||||
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();
|
||||
syz_config.log_level(config.log_level);
|
||||
if config.log_to_stderr {
|
||||
|
|
Loading…
Reference in New Issue
Block a user