From 30535e758c7979ab44eeaa0ba00ecc3de7ea37a1 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 25 May 2026 20:18:33 +0200 Subject: feat(engine): add 'maximized' & 'fullscreen' window creation attrs --- engine/src/windowing/window.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/engine/src/windowing/window.rs b/engine/src/windowing/window.rs index 817ea3c..bfc6416 100644 --- a/engine/src/windowing/window.rs +++ b/engine/src/windowing/window.rs @@ -47,6 +47,26 @@ pub struct CreationAttributes impl_creation_attributes_field_fns!(title, (&), &str, String); impl_creation_attributes_field_fns!(transparent, (), bool, bool); +impl_creation_attributes_field_fns!(maximized, (), bool, bool); + +impl CreationAttributes +{ + pub fn fullscreen(&self) -> Option + { + match self.attrs.fullscreen.as_ref()? { + winit::window::Fullscreen::Borderless(_) => Some(Fullscreen::Borderless), + winit::window::Fullscreen::Exclusive(_) => unreachable!(), + } + } + + pub fn with_fullscreen(mut self, fullscreen: Option) -> Self + { + self.attrs.fullscreen = fullscreen.map(|fullscreen| match fullscreen { + Fullscreen::Borderless => winit::window::Fullscreen::Borderless(None), + }); + self + } +} impl CreationAttributes { @@ -79,6 +99,13 @@ impl Default for CreationAttributes } } +#[derive(Debug)] +#[non_exhaustive] +pub enum Fullscreen +{ + Borderless, +} + #[derive(Debug, Component, Clone, Copy)] pub struct CreationReady; -- cgit v1.2.3-18-g5258