2015-05-15 23:19:33 +10:00
|
|
|
#[cfg(target_os = "android")]
|
|
|
|
#[macro_use]
|
|
|
|
extern crate android_glue;
|
|
|
|
|
|
|
|
extern crate glutin;
|
|
|
|
|
|
|
|
mod support;
|
|
|
|
|
|
|
|
#[cfg(target_os = "android")]
|
|
|
|
android_start!(main);
|
|
|
|
|
|
|
|
fn resize_callback(width: u32, height: u32) {
|
|
|
|
println!("Window resized to {}x{}", width, height);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2015-08-06 06:31:34 +10:00
|
|
|
let mut window = glutin::WindowBuilder::new().with_decorations(false)
|
2015-06-16 07:28:29 +10:00
|
|
|
.with_transparency(true)
|
2015-05-15 23:19:33 +10:00
|
|
|
.build().unwrap();
|
|
|
|
window.set_title("A fantastic window!");
|
|
|
|
window.set_window_resize_callback(Some(resize_callback as fn(u32, u32)));
|
2015-09-29 02:19:36 +10:00
|
|
|
let _ = unsafe { window.make_current() };
|
2015-05-15 23:19:33 +10:00
|
|
|
|
|
|
|
println!("Pixel format of the window: {:?}", window.get_pixel_format());
|
|
|
|
|
|
|
|
let context = support::load(&window);
|
|
|
|
|
2015-06-16 21:48:08 +10:00
|
|
|
for event in window.wait_events() {
|
2015-05-15 23:19:33 +10:00
|
|
|
context.draw_frame((0.0, 0.0, 0.0, 0.0));
|
2015-09-29 02:19:36 +10:00
|
|
|
let _ = window.swap_buffers();
|
2015-05-15 23:19:33 +10:00
|
|
|
|
2015-06-16 21:48:08 +10:00
|
|
|
println!("{:?}", event);
|
|
|
|
|
|
|
|
match event {
|
|
|
|
glutin::Event::Closed => break,
|
|
|
|
_ => ()
|
|
|
|
}
|
2015-05-15 23:19:33 +10:00
|
|
|
}
|
|
|
|
}
|