Improve syntax slightly when handling RedrawRequested (#23)
This commit is contained in:
parent
8801bad58a
commit
31225385c7
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue