Improve syntax slightly when handling RedrawRequested (#23)

This commit is contained in:
Jay Oster 2019-10-23 19:31:42 -07:00 committed by GitHub
parent 8801bad58a
commit 31225385c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -49,15 +49,13 @@ fn main() -> Result<(), Error> {
event_loop.run(move |event, _, control_flow| { event_loop.run(move |event, _, control_flow| {
// The one and only event that winit_input_helper doesn't have for us... // The one and only event that winit_input_helper doesn't have for us...
match event { if let Event::WindowEvent {
Event::WindowEvent { event: WindowEvent::RedrawRequested,
event: WindowEvent::RedrawRequested, ..
.. } = event
} => { {
invaders.draw(pixels.get_frame()); invaders.draw(pixels.get_frame());
pixels.render(); pixels.render();
}
_ => (),
} }
// For everything else, for let winit_input_helper collect events to build its state. // For everything else, for let winit_input_helper collect events to build its state.