mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2024-11-26 15:23:38 +00:00
don't pause the game loop when the window loses focus
This commit is contained in:
parent
ef040a393c
commit
a598f31716
|
@ -237,21 +237,8 @@ impl BackendEventLoop for SDL2EventLoop {
|
|||
state.shutdown();
|
||||
}
|
||||
Event::Window { win_event, .. } => match win_event {
|
||||
WindowEvent::FocusGained | WindowEvent::Shown => {
|
||||
{
|
||||
let mut mutex = GAME_SUSPENDED.lock().unwrap();
|
||||
*mutex = false;
|
||||
}
|
||||
|
||||
state.sound_manager.resume();
|
||||
game.loops = 0;
|
||||
}
|
||||
WindowEvent::FocusLost | WindowEvent::Hidden => {
|
||||
let mut mutex = GAME_SUSPENDED.lock().unwrap();
|
||||
*mutex = true;
|
||||
|
||||
state.sound_manager.pause();
|
||||
}
|
||||
WindowEvent::FocusGained | WindowEvent::Shown => {}
|
||||
WindowEvent::FocusLost | WindowEvent::Hidden => {}
|
||||
WindowEvent::SizeChanged(width, height) => {
|
||||
ctx.screen_size = (width.max(1) as f32, height.max(1) as f32);
|
||||
|
||||
|
|
Loading…
Reference in a new issue