diff --git a/src/display.rs b/src/display.rs index b9f51f5..0271ec2 100644 --- a/src/display.rs +++ b/src/display.rs @@ -47,17 +47,4 @@ impl EventHandler for MPDDisplay { graphics::present(ctx) } - - fn resize_event(&mut self, ctx: &mut Context, width: f32, height: f32) { - graphics::set_screen_coordinates( - ctx, - Rect { - x: 0.0, - y: 0.0, - w: width, - h: height, - }, - ) - .expect("Failed to handle resizing window"); - } } diff --git a/src/main.rs b/src/main.rs index dc9c307..9ceace9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,6 +4,7 @@ mod mpd_handler; use ggez::conf::{WindowMode, WindowSetup}; use ggez::event::winit_event::KeyboardInput; use ggez::event::{self, ControlFlow, EventHandler}; +use ggez::graphics::{self, Rect}; use ggez::ContextBuilder; use std::net::Ipv4Addr; use std::thread; @@ -74,6 +75,18 @@ fn main() -> Result<(), String> { } _ => (), }, + event::winit_event::WindowEvent::Resized(phys_size) => { + graphics::set_screen_coordinates( + ctx, + Rect { + x: 0.0, + y: 0.0, + w: phys_size.width as f32, + h: phys_size.height as f32, + }, + ) + .expect("Failed to handle resizing window"); + } x => println!("Other window event fired: {:?}", x), }, event::winit_event::Event::MainEventsCleared => {