mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-14 22:12:23 -06:00
feat: re-implement pausing mechanism with tick-perfect audio & state pauses
This commit is contained in:
@@ -31,6 +31,10 @@ pub enum AudioEvent {
|
||||
PlayDeath,
|
||||
/// Stop all currently playing sounds
|
||||
StopAll,
|
||||
/// Pause all sounds
|
||||
Pause,
|
||||
/// Resume all sounds
|
||||
Resume,
|
||||
}
|
||||
|
||||
/// Non-send resource wrapper for SDL2 audio system
|
||||
@@ -92,6 +96,22 @@ pub fn audio_system(
|
||||
debug!("Audio disabled, ignoring stop all request");
|
||||
}
|
||||
}
|
||||
AudioEvent::Pause => {
|
||||
if !audio.0.is_disabled() {
|
||||
debug!("Pausing all audio");
|
||||
audio.0.pause_all();
|
||||
} else {
|
||||
debug!("Audio disabled, ignoring pause all request");
|
||||
}
|
||||
}
|
||||
AudioEvent::Resume => {
|
||||
if !audio.0.is_disabled() {
|
||||
debug!("Resuming all audio");
|
||||
audio.0.resume_all();
|
||||
} else {
|
||||
debug!("Audio disabled, ignoring resume all request");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user