This commit is contained in:
none 2023-01-11 11:28:47 +01:00
parent 3342501c3b
commit a462e83394

View File

@ -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
},
_ => (),
}
});