Use RedrawRequested

- THis will likely change after https://github.com/rust-windowing/winit/issues/1082 lands
This commit is contained in:
Jay Oster 2019-09-29 18:42:31 -07:00
parent 2ec303812f
commit 5519aafd18

View file

@ -6,7 +6,7 @@ fn main() -> Result<(), Error> {
env_logger::init(); env_logger::init();
let event_loop = EventLoop::new(); let event_loop = EventLoop::new();
let (_window, surface) = { let (window, surface) = {
let window = winit::window::Window::new(&event_loop).unwrap(); let window = winit::window::Window::new(&event_loop).unwrap();
let surface = wgpu::Surface::create(&window); let surface = wgpu::Surface::create(&window);
@ -26,14 +26,11 @@ fn main() -> Result<(), Error> {
}, },
.. ..
} }
| event::WindowEvent::CloseRequested => { | event::WindowEvent::CloseRequested => *control_flow = ControlFlow::Exit,
*control_flow = ControlFlow::Exit; event::WindowEvent::RedrawRequested => fb.render(),
} _ => (),
_ => {}
}, },
event::Event::EventsCleared => { event::Event::EventsCleared => window.request_redraw(),
fb.render();
}
_ => (), _ => (),
}); });
} }