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
40
41
42
43
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)
}
}