Minimizing on windows sets the window's inner size to 0x0. Adds a check for this occurring, and prevents the main loop from processing when that is the case.
@@ -116,6 +116,7 @@ pub fn main_loop<GS: GameState>(mut bterm: BTerm, mut gamestate: GS) -> Result<(
wc.window().request_redraw();
}
Event::RedrawRequested { .. } => {
+ if wc.window().inner_size().width > 0 {
tock(
&mut bterm,
wc.window().scale_factor() as f32,
@@ -126,6 +127,7 @@ pub fn main_loop<GS: GameState>(mut bterm: BTerm, mut gamestate: GS) -> Result<(
&now,
);
wc.swap_buffers().unwrap();
+ }
crate::hal::fps_sleep(BACKEND.lock().frame_sleep_time, &now, prev_ms);
}
Event::LoopDestroyed => (),
