aboutsummaryrefslogtreecommitdiff
path: root/client/src/window.rs
blob: f00357491df32df5ddaa443332460ddc2f33ed03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use winit::{
    application::ApplicationHandler,
    event::WindowEvent,
    event_loop::ActiveEventLoop,
    window::{Window, WindowAttributes, WindowId},
};

pub struct WindowState {
    window: Option<Window>,
}

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 => {}
                _ => (),
            }
        }
    }
}