2016-02-23 12:56:23 +01:00
|
|
|
extern crate winit;
|
2019-03-09 21:54:29 -05:00
|
|
|
#[macro_use]
|
|
|
|
extern crate stdweb;
|
|
|
|
|
2019-02-05 10:30:33 -05:00
|
|
|
use winit::window::WindowBuilder;
|
|
|
|
use winit::event::{Event, WindowEvent};
|
|
|
|
use winit::event_loop::{EventLoop, ControlFlow};
|
2014-07-27 10:55:37 +02:00
|
|
|
|
|
|
|
fn main() {
|
2019-02-05 10:30:33 -05:00
|
|
|
let event_loop = EventLoop::new();
|
2017-01-28 15:01:59 +01:00
|
|
|
|
2019-02-05 10:30:33 -05:00
|
|
|
let _window = WindowBuilder::new()
|
2016-11-11 22:08:46 +11:00
|
|
|
.with_title("A fantastic window!")
|
2019-02-05 10:30:33 -05:00
|
|
|
.build(&event_loop)
|
2016-11-11 22:08:46 +11:00
|
|
|
.unwrap();
|
2019-03-09 21:54:29 -05:00
|
|
|
console!(log, "Built window!");
|
2014-07-27 10:55:37 +02:00
|
|
|
|
2019-02-05 10:30:33 -05:00
|
|
|
event_loop.run(|event, _, control_flow| {
|
2019-03-09 21:54:29 -05:00
|
|
|
console!(log, format!("{:?}", event));
|
2015-06-16 13:48:08 +02:00
|
|
|
|
|
|
|
match event {
|
2019-02-05 10:30:33 -05:00
|
|
|
Event::WindowEvent {
|
|
|
|
event: WindowEvent::CloseRequested,
|
2018-04-24 16:20:40 -04:00
|
|
|
..
|
2019-02-05 10:30:33 -05:00
|
|
|
} => *control_flow = ControlFlow::Exit,
|
|
|
|
_ => *control_flow = ControlFlow::Wait,
|
2015-06-16 13:48:08 +02:00
|
|
|
}
|
2017-01-28 15:01:59 +01:00
|
|
|
});
|
2014-07-27 10:55:37 +02:00
|
|
|
}
|