From: Tomas Wenström Date: Thu, 14 Feb 2019 14:07:03 +0000 (+0100) Subject: Print some window events X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=d0c9b1f58edc19fcfc8aa484fdb3b13940196a02;p=kaka%2Frust-sdl-test.git Print some window events --- diff --git a/src/main.rs b/src/main.rs index 9efa97d..d474fd6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,6 +22,7 @@ use common::Point2D; use sprites::SpriteManager; use sdl2::video::WindowContext; use sdl2::render::TextureCreator; +use sdl2::event::WindowEvent; #[macro_use] mod common; mod boll; @@ -132,6 +133,13 @@ fn main() { point!(0.0, 0.0), ))) } + Event::Window { win_event: WindowEvent::Resized(x, y), .. } => { println!("window resized({}, {})", x, y) } + Event::Window { win_event: WindowEvent::Maximized, .. } => { println!("window maximized") } + Event::Window { win_event: WindowEvent::Restored, .. } => { println!("window restored") } + Event::Window { win_event: WindowEvent::Enter, .. } => { println!("window enter") } + Event::Window { win_event: WindowEvent::Leave, .. } => { println!("window leave") } + Event::Window { win_event: WindowEvent::FocusGained, .. } => { println!("window focus gained") } + Event::Window { win_event: WindowEvent::FocusLost, .. } => { println!("window focus lost") } _ => {} } }