mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-11 05:21:31 +11:00
Remove window resize call in timer example (#938)
* Remove window resize call in timer example * Move timer_length to separate variable * Re-add _window
This commit is contained in:
parent
de2f0740f7
commit
06244dd492
|
@ -12,16 +12,17 @@ fn main() {
|
||||||
.build(&event_loop)
|
.build(&event_loop)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
let timer_length = Duration::new(1, 0);
|
||||||
|
|
||||||
event_loop.run(move |event, _, control_flow| {
|
event_loop.run(move |event, _, control_flow| {
|
||||||
println!("{:?}", event);
|
println!("{:?}", event);
|
||||||
|
|
||||||
match event {
|
match event {
|
||||||
Event::NewEvents(StartCause::Init) =>
|
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{..}) => {
|
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");
|
println!("\nTimer\n");
|
||||||
_window.set_inner_size(winit::dpi::LogicalSize::new(300.0, 300.0));
|
|
||||||
},
|
},
|
||||||
Event::WindowEvent {
|
Event::WindowEvent {
|
||||||
event: WindowEvent::CloseRequested,
|
event: WindowEvent::CloseRequested,
|
||||||
|
|
Loading…
Reference in a new issue