diff options
| author | HampusM <hampus@hampusmat.com> | 2026-05-25 20:18:33 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-05-25 20:18:33 +0200 |
| commit | 30535e758c7979ab44eeaa0ba00ecc3de7ea37a1 (patch) | |
| tree | 464b1d77d9b1c153082066a03e74a7eda42630e2 /engine/src/windowing/window.rs | |
| parent | f8b7c0cfc73eaeb7ef8dfb3151f93879c97b220a (diff) | |
feat(engine): add 'maximized' & 'fullscreen' window creation attrs
Diffstat (limited to 'engine/src/windowing/window.rs')
| -rw-r--r-- | engine/src/windowing/window.rs | 27 |
1 files changed, 27 insertions, 0 deletions
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<Fullscreen> + { + 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<Fullscreen>) -> 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; |
