From a462e83394657cec1bb29aa26d1c7d5919f96164 Mon Sep 17 00:00:00 2001 From: none Date: Wed, 11 Jan 2023 11:28:47 +0100 Subject: [PATCH] add todo --- src/main.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index ebf0714..ce8a332 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ use winit::{ event::{Event, WindowEvent}, - event_loop::{ControlFlow, EventLoop}, + event_loop::EventLoop, window::WindowBuilder, }; @@ -11,18 +11,26 @@ fn main() { let ver = option_env!("CARGO_PKG_VERSION").unwrap_or("x.x.x"); let event_loop = EventLoop::new(); - let window = WindowBuilder::new() + + WindowBuilder::new() .with_title(format!("IPass - {ver}")) .build(&event_loop).expect("Expected to create window"); event_loop.run(move |event, _, control_flow| { - *control_flow = ControlFlow::Wait; + + control_flow.set_wait(); match event { Event::WindowEvent { event: WindowEvent::CloseRequested, - window_id, - } if window_id == window.id() => *control_flow = ControlFlow::Exit, + .. + } => { + println!("The close button was pressed; stopping"); + control_flow.set_exit(); + }, + Event::RedrawRequested(_) => { + //TODO: redraw application + }, _ => (), } });