1
0
Fork 0
mirror of https://github.com/doukutsu-rs/doukutsu-rs synced 2024-09-28 21:19:24 +00:00

handle 0x0 windows, fixes minimizing on windows

This commit is contained in:
Khang 2021-01-03 19:22:36 -05:00
parent 807b095b15
commit 348cb3045b

View file

@ -398,7 +398,9 @@ pub fn init() -> GameResult {
}
*flow = ControlFlow::Exit;
}
WindowEvent::Resized(_) => {
WindowEvent::Resized(size) => {
// Minimizing a window on Windows causes this event to get called with a 0x0 size
if size.width != 0 && size.height != 0 {
if let (Some(ctx), Some(game)) = (&mut context, &mut game) {
let state_ref = unsafe { &mut *game.state.get() };
@ -409,6 +411,7 @@ pub fn init() -> GameResult {
graphics::window(ctx).update_gfx(&mut game.ui.main_color, &mut game.ui.main_depth);
}
}
}
WindowEvent::Touch(touch) => {
if let Some(game) = &mut game {
let state_ref = unsafe { &mut *game.state.get() };