From d0c9b1f58edc19fcfc8aa484fdb3b13940196a02 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tomas=20Wenstr=C3=B6m?= Date: Thu, 14 Feb 2019 15:07:03 +0100 Subject: [PATCH] Print some window events --- src/main.rs | 8 ++++++++ 1 file changed, 8 insertions(+) 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") } _ => {} } } -- 2.11.0