aboutsummaryrefslogtreecommitdiff
path: root/client/src/window.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-01-08 13:32:01 +0100
committermetamuffin <metamuffin@disroot.org>2025-01-08 13:32:01 +0100
commitac5020c972739d418eabbc2809ccb162890934dc (patch)
treebcd7155ee69a3d39254dbac1f3a3544dfc915782 /client/src/window.rs
parentb2145131ccde0a33b9840ac04c8b7d79e733ae12 (diff)
downloadtwclient-ac5020c972739d418eabbc2809ccb162890934dc.tar
twclient-ac5020c972739d418eabbc2809ccb162890934dc.tar.bz2
twclient-ac5020c972739d418eabbc2809ccb162890934dc.tar.zst
a
Diffstat (limited to 'client/src/window.rs')
-rw-r--r--client/src/window.rs39
1 files changed, 39 insertions, 0 deletions
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<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 => {}
+ _ => (),
+ }
+ }
+ }
+}