|
|
|
@ -171,11 +171,17 @@ pub fn ui_loop() {
|
|
|
|
|
let frame_start = Instant::now();
|
|
|
|
|
|
|
|
|
|
if REDRAW_SCHEDULER.should_draw() {
|
|
|
|
|
skulpin_renderer.draw(&window, |canvas, coordinate_system_helper| {
|
|
|
|
|
if renderer.draw(canvas, coordinate_system_helper) {
|
|
|
|
|
handle_new_grid_size(window.inner_size(), &renderer)
|
|
|
|
|
}
|
|
|
|
|
}).ok();
|
|
|
|
|
if let Err(err) = panic::catch_unwind(|| {
|
|
|
|
|
skulpin_renderer.draw(&window, |canvas, coordinate_system_helper| {
|
|
|
|
|
if renderer.draw(canvas, coordinate_system_helper) {
|
|
|
|
|
handle_new_grid_size(window.inner_size(), &renderer)
|
|
|
|
|
}
|
|
|
|
|
}).ok();
|
|
|
|
|
}) {
|
|
|
|
|
println!("Render failed. Closing app");
|
|
|
|
|
*control_flow = ControlFlow::Exit;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*control_flow = ControlFlow::WaitUntil(frame_start + Duration::from_secs_f32(1.0 / 60.0));
|
|
|
|
|