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