Refactor to derive_more and clean up imports.

This commit is contained in:
Nolan Darilek 2022-01-25 12:27:07 -06:00
parent 7055c53b9a
commit 3dada2fd8d
2 changed files with 5 additions and 22 deletions

View File

@ -12,6 +12,7 @@ alto = "3"
anyhow = "1" anyhow = "1"
bevy = { version = "0.6", default-features = false } bevy = { version = "0.6", default-features = false }
claxon = "0.4" claxon = "0.4"
derive_more = "0.99"
hound = "3" hound = "3"
lewton = "0.10" lewton = "0.10"
minimp3 = "0.5" minimp3 = "0.5"

View File

@ -1,16 +1,11 @@
use std::{ use std::{
collections::HashMap, collections::HashMap,
io::Cursor, io::Cursor,
ops::{Deref, DerefMut},
sync::{Arc, Mutex}, sync::{Arc, Mutex},
}; };
pub use alto::efx; pub use alto::{efx, Context, Device, Source};
pub use alto::Context; use alto::{efx::AuxEffectSlot, Alto, ContextAttrs, Mono, SourceState, StaticSource, Stereo};
pub use alto::Device;
pub use alto::Source;
use alto::{efx::AuxEffectSlot, ContextAttrs, SourceState};
use alto::{Alto, Mono, StaticSource, Stereo};
use bevy::{ use bevy::{
asset::{AssetLoader, HandleId, LoadContext, LoadedAsset}, asset::{AssetLoader, HandleId, LoadContext, LoadedAsset},
prelude::*, prelude::*,
@ -18,6 +13,7 @@ use bevy::{
transform::TransformSystem, transform::TransformSystem,
utils::BoxedFuture, utils::BoxedFuture,
}; };
use derive_more::{Deref, DerefMut};
use lewton::inside_ogg::OggStreamReader; use lewton::inside_ogg::OggStreamReader;
use minimp3::{Decoder, Error}; use minimp3::{Decoder, Error};
@ -247,23 +243,9 @@ impl Sound {
#[reflect(Component)] #[reflect(Component)]
pub struct Listener; pub struct Listener;
#[derive(Default)] #[derive(Default, Deref, DerefMut)]
pub struct GlobalEffects(Vec<AuxEffectSlot>); pub struct GlobalEffects(Vec<AuxEffectSlot>);
impl Deref for GlobalEffects {
type Target = Vec<AuxEffectSlot>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl DerefMut for GlobalEffects {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
fn update_listener( fn update_listener(
context: ResMut<Context>, context: ResMut<Context>,
listener: Query<(Option<&Transform>, Option<&GlobalTransform>), With<Listener>>, listener: Query<(Option<&Transform>, Option<&GlobalTransform>), With<Listener>>,