Enigma 3.2.2
A Simple, Reliable and Efficient Encryption Tool
Loading...
Searching...
No Matches
WindowSettings.hpp
Go to the documentation of this file.
1#pragma once
2#ifndef ENIGMA_WINDOW_SETTINGS_H
3#define ENIGMA_WINDOW_SETTINGS_H
4
5#include <Config/Config.hpp>
6#include <Core/Core.hpp>
7#include <GLFW/glfw3.h> //GLFW_DONT_CARE
8
10
12 /*
13 * Title of the window (Displayed in the title bar)
14 */
15 std::string title = "Enigma";
16
17 /*
18 * Width in pixels of the window
19 */
20 std::int32_t width = 960;
21
22 /*
23 * Height in pixels of the window
24 */
25 std::int32_t height = 720;
26
27 /*
28 * Minimum width of the window.
29 */
30 std::int32_t minimum_width = GLFW_DONT_CARE;
31
32 /*
33 * Minimum height of the window.
34 */
35 std::int32_t minimum_height = GLFW_DONT_CARE;
36
37 /*
38 * Maximum width of the window.
39 */
40 std::int32_t maximum_width = GLFW_DONT_CARE;
41
42 /*
43 * Maximum height of the window.
44 */
45 std::int32_t maximum_height = GLFW_DONT_CARE;
46
47 /*
48 * Window Maximum Frames Per Second.
49 */
50 //std::uint32_t maximum_fps = 60;
51
52 /*
53 * Specifies the desired refresh rate for full screen windows. If set to -1, the highest
54 * available refresh rate will be used. This hint is ignored for windowed mode windows.
55 */
56 std::int32_t refresh_rate = GLFW_DONT_CARE;
57
58 /*
59 * Defines the number of samples to use (For anti-aliasing)
60 */
61 std::uint32_t samples = 4;
62
63
64 /*
65 * Vertical sync swap interval
66 *
67 * Interval 0: unlimited FPS
68 * Interval 1: 60 FPS
69 * Interval 2: 30 FPS
70 */
71 std::int32_t swap_interval = 2;
72
73
74 /*
75 * Specifies if the window is by default in fullscreen or windowed mode
76 */
77 bool fullscreen = false;
78
79 /*
80 * Specifies whether the windowed mode window will have window decorations such as a border, a close widget, etc.
81 * An undecorated window may still allow the user to generate close events on some platforms. This hint is ignored
82 * for full screen windows.
83 */
84 bool decorated = true;
85
86 /*
87 * Specifies whether the windowed mode window will be resizable by the user. The window will still be resizable using
88 * the "SetSize(std::int32_t, std::int32_t)" method of the "Window" class. This hint is ignored for full screen windows
89 */
90 bool resizable = true;
91
92 /*
93 * Specifies whether the windowed mode window will be given input focus when created. This hint is ignored for
94 * full screen and initially hidden windows.
95 */
96 bool focused = true;
97
98 /*
99 * Specifies whether the windowed mode window will be maximized when created. This hint is ignored for full screen windows.
100 */
101 bool maximized = false;
102
103 /*
104 * Specifies whether the windowed mode window will be floating above other regular windows, also called topmost or always-on-top.
105 * This is intended primarily for debugging purposes and cannot be used to implement proper full screen windows. This hint is
106 * ignored for full screen windows.
107 */
108 bool floating = false;
109
110 /*
111 * Specifies whether the windowed mode window will be initially visible. This hint is ignored for full screen windows.
112 */
113 bool visible = true;
114
115 /*
116 * Specifies whether the full screen window will automatically iconify and restore
117 * the previous video mode on input focus loss. This hint is ignored for windowed mode windows
118 */
119 bool auto_iconify = true;
120
121 /*
122 * Show FPS count next to window title in format: title - FPS: x
123 */
124 bool show_fps = false;
125
126 /*
127 * Show realtime RAM usage in percentage
128 */
129 bool show_ram_usage = false;
130
131 /*
132 * Show realtime CPU usage in percentage
133 */
134 bool show_cpu_usage = false;
135
136
138 WindowSettings() = default;
139
141 explicit WindowSettings(const Config& config) : title(config.Get<decltype(WindowSettings::title)>("window", "title", "Enigma")),
142 width(config.Get<decltype(WindowSettings::width)>("window", "width", 800)),
143 height(config.Get<decltype(WindowSettings::height)>("window", "height", 600)),
144 minimum_width(config.Get<decltype(WindowSettings::minimum_width)>("window", "minimum_width", -1)),
145 minimum_height(config.Get<decltype(WindowSettings::minimum_height)>("window", "minimum_height", -1)),
146 maximum_width(config.Get<decltype(WindowSettings::maximum_width)>("window", "maximum_width", -1)),
147 maximum_height(config.Get<decltype(WindowSettings::maximum_height)>("window", "maximum_height", -1)),
148 refresh_rate(config.Get<decltype(WindowSettings::refresh_rate)>("window", "refresh_rate", -1)),
149 samples(config.Get<decltype(WindowSettings::samples)>("window", "samples", 4)),
150 swap_interval(config.Get<decltype(WindowSettings::swap_interval)>("window", "swap_interval", 2)),
151 resizable(config.Get<decltype(WindowSettings::resizable)>("window", "resizable", true)),
152 fullscreen(config.Get<decltype(WindowSettings::fullscreen)>("window", "fullscreen", false)),
153 decorated(config.Get<decltype(WindowSettings::decorated)>("window", "decorated", true)),
154 focused(config.Get<decltype(WindowSettings::focused)>("window", "focused", true)),
155 maximized(config.Get<decltype(WindowSettings::maximized)>("window", "maximized", false)),
156 floating(config.Get<decltype(WindowSettings::floating)>("window", "floating", false)),
157 visible(config.Get<decltype(WindowSettings::visible)>("window", "visible", true)),
158 auto_iconify(config.Get<decltype(WindowSettings::auto_iconify)>("window", "auto_iconify", true)),
159 show_fps(config.Get<decltype(WindowSettings::show_fps)>("window", "show_fps", true)),
160 show_ram_usage(config.Get<decltype(WindowSettings::show_ram_usage)>("window", "show_ram_usage", true)),
161 show_cpu_usage(config.Get<decltype(WindowSettings::show_cpu_usage)>("window", "show_cpu_usage", true)) {
162 }
163
164 public:
165 std::string toString() noexcept {
166 std::ostringstream oss{};
167 oss << "[ title:" << title << ", width:" << width << ", height:" << height
168 << ", minimum_width:" << minimum_width << ", minimum_height:" << minimum_height
169 << ", maximum_width:" << maximum_width << ", maximum_height:" << maximum_height
170 << ", refresh_rate:" << refresh_rate << ", swap_interval:" << swap_interval
171 << ", resizable:" << resizable << ", decorated:" << decorated
172 << ", fullscreen:" << fullscreen << ", samples:" << samples
173 << ", focused:" << focused << ", maximized:" << maximized
174 << ", floating:" << floating << ", visible:" << visible
175 << ", auto_iconify:" << auto_iconify << ", show_fps:" << show_fps
176 << " ]";
177 return oss.str();
178 }
179};
180
182
183#endif // !ENIGMA_WINDOW_SETTINGS_H
#define NS_ENIGMA_BEGIN
Enable/Disable Assertions.
Definition Macros.hpp:13
#define NS_ENIGMA_END
Definition Macros.hpp:14
std::int32_t maximum_height
std::int32_t swap_interval
WindowSettings(const Config &config)
std::int32_t width
std::int32_t maximum_width
std::string title
std::int32_t height
std::int32_t minimum_width
std::uint32_t samples
std::string toString() noexcept
WindowSettings()=default
std::int32_t minimum_height
std::int32_t refresh_rate