From ac5020c972739d418eabbc2809ccb162890934dc Mon Sep 17 00:00:00 2001 From: metamuffin Date: Wed, 8 Jan 2025 13:32:01 +0100 Subject: a --- client/src/window.rs | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 client/src/window.rs (limited to 'client/src/window.rs') diff --git a/client/src/window.rs b/client/src/window.rs new file mode 100644 index 0000000..f003574 --- /dev/null +++ b/client/src/window.rs @@ -0,0 +1,39 @@ +use winit::{ + application::ApplicationHandler, + event::WindowEvent, + event_loop::ActiveEventLoop, + window::{Window, WindowAttributes, WindowId}, +}; + +pub struct WindowState { + window: Option, +} + +impl WindowState { + pub fn new() -> Self { + Self { window: None } + } +} +impl ApplicationHandler for WindowState { + fn resumed(&mut self, event_loop: &ActiveEventLoop) { + self.window = Some( + event_loop + .create_window(WindowAttributes::default().with_maximized(true)) + .unwrap(), + ) + } + + fn window_event( + &mut self, + event_loop: &ActiveEventLoop, + window_id: WindowId, + event: WindowEvent, + ) { + if let Some(win) = &self.window { + match event { + WindowEvent::RedrawRequested => {} + _ => (), + } + } + } +} -- cgit v1.2.3-70-g09d2