use super::winit;
#[derive(Debug, Eq, PartialEq, Clone)]
pub struct Settings {
pub title: String,
pub size: (u32, u32),
pub resizable: bool,
pub fullscreen: bool,
pub maximized: bool,
}
impl Settings {
pub(super) fn into_builder(
self,
events_loop: &winit::event_loop::EventLoop<()>,
) -> winit::window::WindowBuilder {
let monitor = if self.fullscreen {
Some(events_loop.primary_monitor())
} else {
None
};
winit::window::WindowBuilder::new()
.with_title(self.title)
.with_inner_size(winit::dpi::PhysicalSize {
width: self.size.0,
height: self.size.1,
})
.with_resizable(self.resizable)
.with_fullscreen(monitor.map(winit::window::Fullscreen::Borderless))
.with_maximized(self.maximized)
}
}