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,16 +49,14 @@ fn main() -> Result<(), Error> {
event_loop.run(move |event, _, control_flow| {
// The one and only event that winit_input_helper doesn't have for us...
match event {
Event::WindowEvent {
if let Event::WindowEvent {
event: WindowEvent::RedrawRequested,
..
} => {
} = event
{
invaders.draw(pixels.get_frame());
pixels.render();
}
_ => (),
}
// For everything else, for let winit_input_helper collect events to build its state.
// It returns `true` when it is time to update our game state and request a redraw.