mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 06:41:31 +11:00
eb18b3d8b6
This allows for passing the window_resize_callback fn during the window building stage. More importantly, this allows setting the callback without the need for mutable access to the Window, making it possible to set the callback in the downstream glium crate. This may solve tomaka/glium#1232 for most folk.
30 lines
618 B
Rust
30 lines
618 B
Rust
#[cfg(target_os = "android")]
|
|
#[macro_use]
|
|
extern crate android_glue;
|
|
|
|
extern crate winit;
|
|
|
|
#[cfg(target_os = "android")]
|
|
android_start!(main);
|
|
|
|
fn resize_callback(width: u32, height: u32) {
|
|
println!("Window resized to {}x{}", width, height);
|
|
}
|
|
|
|
fn main() {
|
|
let window = winit::WindowBuilder::new()
|
|
.with_title("A fantastic window!")
|
|
.with_window_resize_callback(resize_callback)
|
|
.build()
|
|
.unwrap();
|
|
|
|
for event in window.wait_events() {
|
|
println!("{:?}", event);
|
|
|
|
match event {
|
|
winit::Event::Closed => break,
|
|
_ => ()
|
|
}
|
|
}
|
|
}
|