mirror of
https://github.com/lightsoutgames/bevy_openal.git
synced 2024-12-03 13:35:56 +00:00
Add helpers to play, pause, and stop sound sources.
This commit is contained in:
parent
aec72c3e57
commit
acc004b2ef
21
src/lib.rs
21
src/lib.rs
|
@ -143,6 +143,27 @@ impl Default for Sound {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Sound {
|
||||
pub fn play(&mut self) {
|
||||
if let Some(source) = self.source.as_mut() {
|
||||
source.play();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn stop(&mut self) {
|
||||
if let Some(source) = self.source.as_mut() {
|
||||
source.stop();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn pause(&mut self) {
|
||||
if let Some(source) = self.source.as_mut() {
|
||||
source.pause();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub type Sounds = HashMap<String, Sound>;
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
Loading…
Reference in New Issue
Block a user