diff --git a/examples/minimal-fltk/Cargo.toml b/examples/minimal-fltk/Cargo.toml index b8b38537..dc8026dc 100644 --- a/examples/minimal-fltk/Cargo.toml +++ b/examples/minimal-fltk/Cargo.toml @@ -11,7 +11,7 @@ default = ["optimize"] [dependencies] error-iter = "0.4" -fltk = { version = "1", features = ["rwh05", "no-images", "no-pango"] } +fltk = { version = "1", features = ["rwh06", "no-images", "no-pango"] } env_logger = "0.10" log = "0.4" pixels = { path = "../.." } diff --git a/examples/minimal-fltk/src/main.rs b/examples/minimal-fltk/src/main.rs index fd7f1dbb..7b77ef30 100644 --- a/examples/minimal-fltk/src/main.rs +++ b/examples/minimal-fltk/src/main.rs @@ -32,14 +32,6 @@ fn main() -> Result<(), Error> { win.end(); win.show(); - let mut pixels = { - let pixel_width = win.pixel_w() as u32; - let pixel_height = win.pixel_h() as u32; - let surface_texture = SurfaceTexture::new(pixel_width, pixel_height, &win); - - Pixels::new(WIDTH, HEIGHT, surface_texture)? - }; - let mut world = World::new(); // Handle resize events @@ -53,6 +45,14 @@ fn main() -> Result<(), Error> { surface_resize.borrow_mut().replace((width, height)); }); + let mut pixels = { + let pixel_width = win.pixel_w() as u32; + let pixel_height = win.pixel_h() as u32; + let surface_texture = SurfaceTexture::new(pixel_width, pixel_height, &win); + + Pixels::new(WIDTH, HEIGHT, surface_texture)? + }; + while app.wait() { // Update internal state world.update();