2020-09-09 17:58:30 -08:00
|
|
|
use simple_logger::SimpleLogger;
|
2019-06-21 11:33:15 -04:00
|
|
|
use winit::{
|
|
|
|
dpi::LogicalSize,
|
|
|
|
event::{Event, WindowEvent},
|
|
|
|
event_loop::{ControlFlow, EventLoop},
|
|
|
|
window::WindowBuilder,
|
|
|
|
};
|
2018-06-14 19:42:18 -04:00
|
|
|
|
2016-11-23 09:41:53 -05:00
|
|
|
fn main() {
|
2020-09-09 17:58:30 -08:00
|
|
|
SimpleLogger::new().init().unwrap();
|
2019-02-05 10:30:33 -05:00
|
|
|
let event_loop = EventLoop::new();
|
2017-01-28 15:45:01 +01:00
|
|
|
|
2019-06-21 11:33:15 -04:00
|
|
|
let window = WindowBuilder::new().build(&event_loop).unwrap();
|
2016-11-23 09:41:53 -05:00
|
|
|
|
2019-05-29 21:29:54 -04:00
|
|
|
window.set_min_inner_size(Some(LogicalSize::new(400.0, 200.0)));
|
|
|
|
window.set_max_inner_size(Some(LogicalSize::new(800.0, 400.0)));
|
2018-03-23 05:35:35 -04:00
|
|
|
|
2019-02-05 10:30:33 -05:00
|
|
|
event_loop.run(move |event, _, control_flow| {
|
2020-01-05 02:12:03 -05:00
|
|
|
*control_flow = ControlFlow::Wait;
|
2017-01-28 15:45:01 +01:00
|
|
|
println!("{:?}", event);
|
|
|
|
|
2016-11-23 09:41:53 -05:00
|
|
|
match event {
|
2019-06-21 11:33:15 -04:00
|
|
|
Event::WindowEvent {
|
|
|
|
event: WindowEvent::CloseRequested,
|
|
|
|
..
|
|
|
|
} => *control_flow = ControlFlow::Exit,
|
2020-01-05 02:12:03 -05:00
|
|
|
_ => (),
|
2016-11-23 09:41:53 -05:00
|
|
|
}
|
2017-01-28 15:45:01 +01:00
|
|
|
});
|
2016-11-23 09:41:53 -05:00
|
|
|
}
|