From 06244dd4929d1acf1f4650ecb38ca73c1ec22743 Mon Sep 17 00:00:00 2001 From: Osspial Date: Wed, 19 Jun 2019 22:06:09 -0400 Subject: [PATCH] Remove window resize call in timer example (#938) * Remove window resize call in timer example * Move timer_length to separate variable * Re-add _window --- examples/timer.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/timer.rs b/examples/timer.rs index 97b61b84..0d63e1da 100644 --- a/examples/timer.rs +++ b/examples/timer.rs @@ -12,16 +12,17 @@ fn main() { .build(&event_loop) .unwrap(); + let timer_length = Duration::new(1, 0); + event_loop.run(move |event, _, control_flow| { println!("{:?}", event); match event { Event::NewEvents(StartCause::Init) => - *control_flow = ControlFlow::WaitUntil(Instant::now() + Duration::new(1, 0)), + *control_flow = ControlFlow::WaitUntil(Instant::now() + timer_length), Event::NewEvents(StartCause::ResumeTimeReached{..}) => { - *control_flow = ControlFlow::WaitUntil(Instant::now() + Duration::new(1, 0)); + *control_flow = ControlFlow::WaitUntil(Instant::now() + timer_length); println!("\nTimer\n"); - _window.set_inner_size(winit::dpi::LogicalSize::new(300.0, 300.0)); }, Event::WindowEvent { event: WindowEvent::CloseRequested,