2016-11-24 01:41:53 +11:00
|
|
|
extern crate winit;
|
|
|
|
|
2018-06-15 09:42:18 +10:00
|
|
|
use winit::dpi::LogicalSize;
|
2019-02-06 02:30:33 +11:00
|
|
|
use winit::window::WindowBuilder;
|
|
|
|
use winit::event::{Event, WindowEvent};
|
|
|
|
use winit::event_loop::{EventLoop, ControlFlow};
|
2018-06-15 09:42:18 +10:00
|
|
|
|
2016-11-24 01:41:53 +11:00
|
|
|
fn main() {
|
2019-02-06 02:30:33 +11:00
|
|
|
let event_loop = EventLoop::new();
|
2017-01-29 01:45:01 +11:00
|
|
|
|
2019-02-06 02:30:33 +11:00
|
|
|
let window = WindowBuilder::new()
|
|
|
|
.build(&event_loop)
|
2016-11-24 01:41:53 +11:00
|
|
|
.unwrap();
|
|
|
|
|
2018-06-15 09:42:18 +10:00
|
|
|
window.set_min_dimensions(Some(LogicalSize::new(400.0, 200.0)));
|
|
|
|
window.set_max_dimensions(Some(LogicalSize::new(800.0, 400.0)));
|
2018-03-23 20:35:35 +11:00
|
|
|
|
2019-02-06 02:30:33 +11:00
|
|
|
event_loop.run(move |event, _, control_flow| {
|
2017-01-29 01:45:01 +11:00
|
|
|
println!("{:?}", event);
|
|
|
|
|
2016-11-24 01:41:53 +11:00
|
|
|
match event {
|
2019-02-06 02:30:33 +11:00
|
|
|
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } =>
|
|
|
|
*control_flow = ControlFlow::Exit,
|
|
|
|
_ => *control_flow = ControlFlow::Wait,
|
2016-11-24 01:41:53 +11:00
|
|
|
}
|
2017-01-29 01:45:01 +11:00
|
|
|
});
|
2016-11-24 01:41:53 +11:00
|
|
|
}
|