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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
use crate::{
Colour,
graphics::GraphicsSettings,
};
use glium::glutin::{
window::WindowAttributes,
PixelFormatRequirements,
};
#[derive(Clone,Debug)]
pub struct WindowSettings{
//--General attributes--\\
pub general:GeneralSettings,
//--Window attributes--\\
pub window_attributes:WindowAttributes,
//--OpenGL attributes--\\
/// Whether to enable the debug flag of the context.
///
/// Debug contexts are usually slower but give better error reporting.
///
/// The default is false.
pub debug:bool,
/// Whether to use vsync.
/// If vsync is enabled, calling swap_buffers will block until the screen refreshes.
/// This is typically used to prevent screen tearing.
///
/// The default is false.
pub vsync:bool,
//--Pixel format requirements--\\
pub pixel_fmt_req:PixelFormatRequirements,
//--Local graphics attributes--\\
pub graphics_base_settings:GraphicsSettings,
}
impl WindowSettings{
/// Default settings.
pub fn new()->WindowSettings{
Self{
//--General attributes--\\
general:GeneralSettings::new(),
//--Window attributes--\\
window_attributes:WindowAttributes::default(),
//--OpenGL attributes--\\
debug:false,
vsync:false,
//--Pixel format requirements--\\
pixel_fmt_req:PixelFormatRequirements::default(),
//--Local graphics attributes--\\
graphics_base_settings:GraphicsSettings::new(),
}
}
}
#[derive(Clone,Debug)]
pub struct GeneralSettings{
/// Whether the window should be filled with given colour upon creation.
///
/// The default is None.
pub initial_colour:Option<Colour>,
/// The amount of the update events per second.
///
/// The default is 50.
pub updates_per_second:u32,
}
impl GeneralSettings{
pub fn new()->GeneralSettings{
Self{
initial_colour:None,
updates_per_second:50u32,
}
}
}