galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
Window.cpp
Go to the documentation of this file.
1
7
8#define SDL_STBIMG_SDL3
9
10#include <entt/signal/dispatcher.hpp>
11#include <glad/glad.h>
12#include <SDL_stbimage.h>
13
29
30#include "Window.hpp"
31
32#ifdef GALAXY_WIN_PLATFORM
35#endif
36
37namespace galaxy
38{
40 : m_window {nullptr}
41 , m_context {nullptr}
42 , m_open {true}
43 {
44 SDL_zero(m_events);
45
46 if (SDL_ScreenSaverEnabled())
47 {
48 SDL_DisableScreenSaver();
49 }
50
51 SDL_WindowFlags flags = SDL_WINDOW_OPENGL | SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_MOUSE_FOCUS | SDL_WINDOW_HIDDEN | SDL_WINDOW_HIGH_PIXEL_DENSITY;
53 {
54 flags |= SDL_WINDOW_FULLSCREEN;
55 }
56 else
57 {
59 {
60 flags |= SDL_WINDOW_MAXIMIZED;
61 }
62 }
63
65 {
66 flags |= SDL_WINDOW_MOUSE_GRABBED;
67 }
68
70 {
71 flags |= SDL_WINDOW_RESIZABLE;
72 }
73
74 SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
75 SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
76 SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
77 SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
78 // SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, ); /**< the minimum number of bits for frame buffer size; defaults to 0. */
79 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
80 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
81 SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
82 // SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE, ); /**< the minimum number of bits for the red channel of the accumulation buffer; defaults to 0. */
83 // SDL_GL_SetAttribute(SDL_GL_ACCUM_GREEN_SIZE, ); /**< the minimum number of bits for the green channel of the accumulation buffer; defaults to 0. */
84 // SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE, ); /**< the minimum number of bits for the blue channel of the accumulation buffer; defaults to 0. */
85 // SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE, ); /**< the minimum number of bits for the alpha channel of the accumulation buffer; defaults to 0. */
86 SDL_GL_SetAttribute(SDL_GL_STEREO, 0);
87 SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);
88 SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);
89 SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
90 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
91 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 6);
92 SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG | SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG);
93 SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
94 SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 0);
95 SDL_GL_SetAttribute(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, 1);
96 // SDL_GL_SetAttribute(SDL_GL_CONTEXT_RELEASE_BEHAVIOR, ); /**< sets context the release behavior. See SDL_GLContextReleaseFlag; defaults to FLUSH. */
97 // SDL_GL_SetAttribute(SDL_GL_CONTEXT_RESET_NOTIFICATION, ); /**< set context reset notification. See SDL_GLContextResetNotification; defaults to NO_NOTIFICATION. */
98
99 m_window = SDL_CreateWindow(Settings::title().c_str(), Settings::window_width(), Settings::window_height(), flags);
100 if (m_window)
101 {
102 m_context = SDL_GL_CreateContext(m_window);
103 if (m_context)
104 {
105 if (SDL_GL_MakeCurrent(m_window, m_context))
106 {
107 if (gladLoadGLLoader((GLADloadproc)SDL_GL_GetProcAddress))
108 {
109 SDL_GL_SetSwapInterval(Settings::vsync());
110 SDL_SetWindowAlwaysOnTop(m_window, false);
111 SDL_SetWindowBordered(m_window, Settings::window_border());
112 SDL_SetWindowFocusable(m_window, true);
113 SDL_SetWindowFullscreenMode(m_window, nullptr); // Borderless Fullscreen mode.
114 SDL_SetWindowKeyboardGrab(m_window, false);
115 SDL_SetWindowMinimumSize(m_window, 640, 360);
116 SDL_SetWindowPosition(m_window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
117
122 {
124 }
125 else
126 {
128 }
129
130 // Debug configuration.
131 glEnable(GL_DEBUG_OUTPUT);
132 glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
133
134 glDebugMessageCallback(
135 [](GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam) {
136 GALAXY_UNUSED(source);
137 GALAXY_UNUSED(type);
138 GALAXY_UNUSED(id);
139 GALAXY_UNUSED(length);
140 GALAXY_UNUSED(userParam);
141
142 switch (severity)
143 {
144 case GL_DEBUG_SEVERITY_HIGH:
145 GALAXY_LOG(GALAXY_ERROR, "[OpenGL] - {0}", message);
146 break;
147 case GL_DEBUG_SEVERITY_MEDIUM:
148 GALAXY_LOG(GALAXY_WARN, "[OpenGL] - {0}", message);
149 break;
150 case GL_DEBUG_SEVERITY_LOW:
151 GALAXY_LOG(GALAXY_INFO, "[OpenGL] - {0}", message);
152 break;
153 default:
154 GALAXY_LOG(GALAXY_INFO, "[OpenGL] - {0}", message);
155 break;
156 };
157 },
158 nullptr
159 );
160
161 glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_NOTIFICATION, 0, nullptr, GL_FALSE);
162
163 // Configure global GL state.
164 glDisable(GL_FRAMEBUFFER_SRGB);
165 glDisable(GL_CULL_FACE);
166 glDisable(GL_SCISSOR_TEST);
167 glDisable(GL_MULTISAMPLE); // Use provided SMAA.
168
169 glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
170 glEnable(GL_PROGRAM_POINT_SIZE);
171 glEnable(GL_DEPTH_TEST);
172 glEnable(GL_STENCIL_TEST);
173 glEnable(GL_BLEND);
174
175 // GL state function configuration.
176 glCullFace(GL_BACK);
177 glDepthFunc(GL_LEQUAL);
178 glBlendEquation(GL_FUNC_ADD);
179 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
180 }
181 else
182 {
183 GALAXY_LOG(GALAXY_FATAL, "Failed to initialize glad.");
184 }
185 }
186 else
187 {
188 GALAXY_LOG(GALAXY_FATAL, "Failed to initialize OpenGL context into SDL.");
189 }
190 }
191 else
192 {
193 GALAXY_LOG(GALAXY_FATAL, "Failed to initialize OpenGL context.");
194 }
195 }
196 else
197 {
198 GALAXY_LOG(GALAXY_FATAL, "Failed to initialize SDL window.");
199 }
200 }
201
203 {
204 SDL_GL_DestroyContext(m_context);
205 SDL_DestroyWindow(m_window);
206
207 m_context = nullptr;
208 m_window = nullptr;
209 m_open = false;
210 }
211
212 void Window::process_events(entt::dispatcher& dispatcher)
213 {
214 while (SDL_PollEvent(&m_events))
215 {
216 switch (m_events.type)
217 {
218 case SDL_EVENT_QUIT:
219 case SDL_EVENT_WINDOW_CLOSE_REQUESTED:
220 case SDL_EVENT_WINDOW_DESTROYED:
221 dispatcher.trigger(WindowClosed {});
222 close();
223 break;
224
225 case SDL_EVENT_LOCALE_CHANGED:
226 // TODO: Handle Languages.
227 break;
228
229 case SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED:
230 case SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED:
231 // SDL_GetDisplayContentScale
232 // SDL_GetWindowDisplayScale
233 // https://wiki.libsdl.org/SDL3/README-highdpi
234 break;
235
236 case SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED:
237 // SDL_GetWindowSizeInPixels
238 break;
239
240 case SDL_EVENT_WINDOW_RESIZED:
241 case SDL_EVENT_WINDOW_MAXIMIZED:
242 case SDL_EVENT_WINDOW_RESTORED:
243 case SDL_EVENT_WINDOW_ENTER_FULLSCREEN:
244 case SDL_EVENT_WINDOW_LEAVE_FULLSCREEN:
245 {
246 const auto size = get_pixel_size();
247
248 // clang-format off
249 auto wr = WindowResized
250 {
251 .m_width = size.x,
252 .m_height = size.y
253 };
254 // clang-format on
255
256 dispatcher.trigger(wr);
257 }
258 break;
259
260 case SDL_EVENT_WINDOW_DISPLAY_CHANGED:
261 // TODO
262 // HANDLE RESIZE + DISPLAY SCALE + PIXEL SIZE SCALE.
263 break;
264
265 case SDL_EVENT_WINDOW_MOUSE_ENTER:
266 case SDL_EVENT_WINDOW_FOCUS_GAINED:
267 dispatcher.trigger(GainedFocus {});
268 break;
269
270 case SDL_EVENT_WINDOW_MOUSE_LEAVE:
271 case SDL_EVENT_WINDOW_FOCUS_LOST:
272 dispatcher.trigger(LostFocus {});
273 break;
274
275 case SDL_EVENT_KEY_DOWN:
276 {
277 // clang-format off
278 auto kp = KeyPressed
279 {
280 .m_scancode = m_events.key.scancode,
281 .m_key = static_cast<Keys>(m_events.key.key),
282 .m_mod = static_cast<KeyMods>(m_events.key.mod),
283 .m_raw = m_events.key.raw,
284 .m_repeat = m_events.key.repeat
285 };
286 // clang-format on
287
288 dispatcher.trigger(kp);
289 }
290 break;
291
292 case SDL_EVENT_KEY_UP:
293 {
294 // clang-format off
295 auto kr = KeyReleased
296 {
297 .m_scancode = m_events.key.scancode,
298 .m_key = static_cast<Keys>(m_events.key.key),
299 .m_mod = static_cast<KeyMods>(m_events.key.mod),
300 .m_raw = m_events.key.raw,
301 .m_repeat = m_events.key.repeat
302 };
303 // clang-format on
304
305 dispatcher.trigger(kr);
306 }
307 break;
308
309 case SDL_EVENT_TEXT_INPUT:
310 // case SDL_EVENT_TEXT_EDITING:
311 // case SDL_EVENT_TEXT_EDITING_CANDIDATES:
312 {
313 // clang-format off
314 auto ki = KeyInput
315 {
316 .m_text = m_events.text.text
317 };
318 // clang-format on
319
320 dispatcher.trigger(ki);
321 }
322 break;
323
324 case SDL_EVENT_MOUSE_MOTION:
325 {
326 // clang-format off
327 auto mm = MouseMoved
328 {
329 .m_xpos = m_events.motion.x,
330 .m_ypos = m_events.motion.y,
331 .m_xrel = m_events.motion.xrel,
332 .m_yrel = m_events.motion.yrel
333 };
334 // clang-format on
335
336 dispatcher.trigger(mm);
337 }
338 break;
339
340 case SDL_EVENT_MOUSE_BUTTON_DOWN:
341 {
342 // clang-format off
343 auto mp = MousePressed
344 {
345 .m_xpos = m_events.button.x,
346 .m_ypos = m_events.button.y,
347 .m_clicks = m_events.button.clicks,
348 .m_button = static_cast<MouseButton>(m_events.button.button)
349 };
350 // clang-format on
351
352 dispatcher.trigger(mp);
353 }
354 break;
355
356 case SDL_EVENT_MOUSE_BUTTON_UP:
357 {
358 // clang-format off
359 auto mr = MouseReleased
360 {
361 .m_xpos = m_events.button.x,
362 .m_ypos = m_events.button.y,
363 .m_clicks = m_events.button.clicks,
364 .m_button = static_cast<MouseButton>(m_events.button.button)
365 };
366 // clang-format on
367
368 dispatcher.trigger(mr);
369 }
370 break;
371
372 case SDL_EVENT_MOUSE_WHEEL:
373 {
374 // clang-format off
375 auto mw = MouseWheel
376 {
377 .m_amount_x = m_events.wheel.x,
378 .m_amount_y = m_events.wheel.y,
379 .m_direction = m_events.wheel.direction,
380 .m_mouse_x = m_events.wheel.mouse_x,
381 .m_mouse_y = m_events.wheel.mouse_y,
382 .m_total_x = m_events.wheel.integer_x,
383 .m_total_y = m_events.wheel.integer_y
384 };
385 // clang-format on
386
387 dispatcher.trigger(mw);
388 }
389 break;
390
391 case SDL_EVENT_DROP_BEGIN:
392 // TODO
393 /*Drag and drop events
394 SDL_EVENT_DROP_FILE = 0x1000, /**< The system requests a file open *
395 SDL_EVENT_DROP_TEXT, /**< text/plain drag-and-drop event *
396 SDL_EVENT_DROP_BEGIN, /**< A new set of drops is beginning (NULL filename) *
397 SDL_EVENT_DROP_COMPLETE, /**< Current set of drops is now complete (NULL filename) *
398 SDL_EVENT_DROP_POSITION, /**< Position while moving over the window */
399 // SDL_DropEvent
400 break;
401
402 case SDL_EVENT_JOYSTICK_AXIS_MOTION:
403 case SDL_EVENT_JOYSTICK_BALL_MOTION:
404 case SDL_EVENT_JOYSTICK_HAT_MOTION:
405 case SDL_EVENT_JOYSTICK_BUTTON_DOWN:
406 case SDL_EVENT_JOYSTICK_BUTTON_UP:
407 case SDL_EVENT_JOYSTICK_REMOVED:
408 case SDL_EVENT_JOYSTICK_BATTERY_UPDATED:
409 case SDL_EVENT_JOYSTICK_UPDATE_COMPLETE:
410 // TODO
411 GALAXY_LOG(GALAXY_WARN, "Unsupported joystick event detected.");
412 break;
413
414 case SDL_EVENT_GAMEPAD_AXIS_MOTION:
415 case SDL_EVENT_GAMEPAD_BUTTON_DOWN:
416 case SDL_EVENT_GAMEPAD_BUTTON_UP:
417 case SDL_EVENT_GAMEPAD_REMOVED:
418 case SDL_EVENT_GAMEPAD_REMAPPED:
419 case SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN:
420 case SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION:
421 case SDL_EVENT_GAMEPAD_TOUCHPAD_UP:
422 case SDL_EVENT_GAMEPAD_SENSOR_UPDATE:
423 case SDL_EVENT_GAMEPAD_UPDATE_COMPLETE:
424 case SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED:
425 // TODO
426 GALAXY_LOG(GALAXY_WARN, "Unsupported gamepad event detected.");
427 break;
428
429 case SDL_EVENT_FINGER_DOWN:
430 case SDL_EVENT_FINGER_UP:
431 case SDL_EVENT_FINGER_MOTION:
432 case SDL_EVENT_FINGER_CANCELED:
433 // TODO
434 GALAXY_LOG(GALAXY_WARN, "Unsupported touch event detected.");
435 break;
436
437 case SDL_EVENT_PEN_PROXIMITY_IN:
438 case SDL_EVENT_PEN_PROXIMITY_OUT:
439 case SDL_EVENT_PEN_DOWN:
440 case SDL_EVENT_PEN_UP:
441 case SDL_EVENT_PEN_BUTTON_DOWN:
442 case SDL_EVENT_PEN_BUTTON_UP:
443 case SDL_EVENT_PEN_MOTION:
444 case SDL_EVENT_PEN_AXIS:
445 // TODO
446 GALAXY_LOG(GALAXY_WARN, "Unsupported pen event detected.");
447 break;
448 }
449 }
450 }
451
452 void Window::close() noexcept
453 {
454 m_open = false;
455 }
456
457 void Window::swap() const noexcept
458 {
459 SDL_GL_SwapWindow(m_window);
460 }
461
462 void Window::show() const noexcept
463 {
464 SDL_ShowWindow(m_window);
465 }
466
467 void Window::hide() const noexcept
468 {
469 SDL_HideWindow(m_window);
470 }
471
472 void Window::minimize() const noexcept
473 {
474 SDL_MinimizeWindow(m_window);
475 SDL_SyncWindow(m_window);
476 }
477
478 void Window::maximize() const noexcept
479 {
480 SDL_MaximizeWindow(m_window);
481 SDL_SyncWindow(m_window);
482 // TODO: trigger resize.
483 }
484
485 void Window::restore() const noexcept
486 {
487 SDL_RestoreWindow(m_window);
488 SDL_SyncWindow(m_window);
489 // TODO: trigger resize.
490 }
491
492 void Window::raise() const noexcept
493 {
494 SDL_RaiseWindow(m_window);
495 }
496
497 void Window::request_attention() const noexcept
498 {
499 SDL_FlashWindow(m_window, SDL_FlashOperation::SDL_FLASH_UNTIL_FOCUSED);
500 }
501
502 void Window::resize(const int width, const int height) const noexcept
503 {
504 SDL_SetWindowSize(m_window, width, height);
505 // TODO: trigger resize.
506 }
507
508 void Window::set_fullscreen(const bool fullscreen) const noexcept
509 {
510 SDL_SetWindowFullscreen(m_window, fullscreen);
511 // TODO: trigger resize.
512 }
513
514 void Window::set_taskbar_progress(const float progress) noexcept
515 {
516 SDL_SetWindowProgressValue(m_window, std::clamp(progress, 0.0f, 1.0f));
517 }
518
519 void Window::append_title(const std::string& append)
520 {
521 const auto title = Settings::title() + append;
522 SDL_SetWindowTitle(m_window, title.c_str());
523 }
524
525 void Window::set_icon(const std::string& icon) noexcept
526 {
527 if (!icon.empty())
528 {
529 auto& fs = entt::locator<VirtualFileSystem>::value();
530
531 auto data = fs.read_binary(icon);
532 if (!data.empty())
533 {
534 auto surface = STBIMG_LoadFromMemory(data.data(), static_cast<int>(data.size()));
535 if (surface)
536 {
537 SDL_SetWindowIcon(m_window, surface);
538 }
539 else
540 {
541 GALAXY_LOG(GALAXY_ERROR, SDL_GetError());
542 }
543
544 SDL_DestroySurface(surface);
545 }
546 else
547 {
548 GALAXY_LOG(GALAXY_ERROR, "Failed to read '{0}' from the vfs.", icon);
549 }
550 }
551 }
552
553 bool Window::is_open() const noexcept
554 {
555 return m_open;
556 }
557
559 {
560 return m_mouse;
561 }
562
564 {
565 return m_keyboard;
566 }
567
568 glm::ivec2 Window::get_pixel_size() noexcept
569 {
570 auto vec2 = glm::ivec2();
571 SDL_GetWindowSizeInPixels(m_window, &vec2.x, &vec2.y);
572
573 return vec2;
574 }
575
576 SDL_Window* Window::handle() const noexcept
577 {
578 return m_window;
579 }
580
581 SDL_GLContext Window::context() const noexcept
582 {
583 return m_context;
584 }
585} // namespace galaxy
586
587#ifdef GALAXY_WIN_PLATFORM
589#endif
#define GALAXY_INFO
Log.hpp galaxy.
Definition Log.hpp:22
#define GALAXY_LOG(level, msg,...)
Definition Log.hpp:28
#define GALAXY_WARN
Definition Log.hpp:23
#define GALAXY_FATAL
Definition Log.hpp:25
#define GALAXY_ERROR
Definition Log.hpp:24
#define GALAXY_DISABLE_WARNING_POP
Definition Pragma.hpp:57
#define GALAXY_DISABLE_WARNING(x)
Definition Pragma.hpp:58
#define GALAXY_UNUSED(var)
Pragma.hpp galaxy.
Definition Pragma.hpp:16
#define GALAXY_DISABLE_WARNING_PUSH
Macro for windows platform detection.
Definition Pragma.hpp:56
Physical keyboard device and state management.
Definition Keyboard.hpp:23
Physical mouse device and state management.
Definition Mouse.hpp:22
void hide_cursor() const noexcept
Hide cursor.
Definition Mouse.cpp:49
void show_cursor() const noexcept
Show cursor.
Definition Mouse.cpp:44
void set_cursor_custom(const std::string &cursor, const glm::ivec2 &hotspot) noexcept
Set custom cursor texture.
Definition Mouse.cpp:69
void bind_window(SDL_Window *window) noexcept
Bind SDL3 window to this object.
SDL_Window * m_window
SDL window handle.
Definition Window.hpp:210
void set_fullscreen(const bool fullscreen) const noexcept
Toggle fullscreen.
Definition Window.cpp:508
~Window()
Destructor.
Definition Window.cpp:202
SDL_Window * handle() const noexcept
Get SDL window pointer.
Definition Window.cpp:576
SDL_GLContext context() const noexcept
Get SDL GL context.
Definition Window.cpp:581
void swap() const noexcept
Swap backbuffer with window framebuffer.
Definition Window.cpp:457
bool is_open() const noexcept
Is the window open or closed.
Definition Window.cpp:553
void raise() const noexcept
Raise the window to be on top of other windows.
Definition Window.cpp:492
void resize(const int width, const int height) const noexcept
Resizes window.
Definition Window.cpp:502
Window()
Window creation constructor.
Definition Window.cpp:39
void maximize() const noexcept
Maximize window.
Definition Window.cpp:478
Keyboard & get_keyboard() noexcept
Get keyboard.
Definition Window.cpp:563
void append_title(const std::string &append)
Append to window title.
Definition Window.cpp:519
Mouse m_mouse
Mouse assigned to window.
Definition Window.hpp:235
Keyboard m_keyboard
Keyboard assigned to window.
Definition Window.hpp:230
void close() noexcept
Close window.
Definition Window.cpp:452
void set_taskbar_progress(const float progress) noexcept
Sets the taskbar icon progress overlay.
Definition Window.cpp:514
bool m_open
Window state flag.
Definition Window.hpp:220
glm::ivec2 get_pixel_size() noexcept
Get window size in pixels.
Definition Window.cpp:568
void hide() const noexcept
Hide window.
Definition Window.cpp:467
void process_events(entt::dispatcher &dispatcher)
Handles all events for the window in this frame and sends to the dispatcher.
Definition Window.cpp:212
SDL_GLContext m_context
SDL OpenGL context.
Definition Window.hpp:215
void show() const noexcept
Show window.
Definition Window.cpp:462
void minimize() const noexcept
Minimize window.
Definition Window.cpp:472
SDL_Event m_events
Core event data.
Definition Window.hpp:225
Mouse & get_mouse() noexcept
Get mouse cursor.
Definition Window.cpp:558
void set_icon(const std::string &icon) noexcept
Set window icon.
Definition Window.cpp:525
void request_attention() const noexcept
Flash window on taskbar for user attention.
Definition Window.cpp:497
void restore() const noexcept
Restore window to previous *mize state.
Definition Window.cpp:485
Animated.cpp galaxy.
Definition Animated.cpp:16
Keys
Enum class representing keys.
Definition Keys.hpp:19
KeyMods
Enum class for key modifiers.
Definition Keys.hpp:282
MouseButton
Enum class representing mouse buttons.
POD tag to allow a function to accept a dispatched focus gained event.
Unicode text data from a textinput event.
Definition KeyInput.hpp:21
Contains data on key that was pressed.
Contains data on key that was released.
POD tag to allow a function to accept a dispatched focus lost event.
Definition LostFocus.hpp:19
Contains data relating to a mouse moved event.
Contains data relating to a mouse pressed event.
Contains data relating to a mouse released event.
Contains mouse wheel movement data.
static auto window_height() noexcept -> int
Window creation height.
Definition Settings.cpp:121
static auto fullscreen() noexcept -> bool
Is window started fullscreen.
Definition Settings.cpp:131
static auto vsync() noexcept -> bool
Vsync control.
Definition Settings.cpp:141
static auto window_width() noexcept -> int
Window creation width.
Definition Settings.cpp:116
static auto window_border() noexcept -> bool
Controls if a window has a border around it (including titlebar).
Definition Settings.cpp:151
static auto window_resizable() noexcept -> bool
Is the window resizable.
Definition Settings.cpp:146
static auto maximized() noexcept -> bool
Is window started maximized?
Definition Settings.cpp:136
static auto title() noexcept -> const std::string &
Game title.
Definition Settings.cpp:181
static auto cursor_show() noexcept -> bool
Is the mouse cursor visible or not.
Definition Settings.cpp:161
static auto cursor_hotspot() noexcept -> const glm::ivec2 &
Cursor selector point (hotspot).
Definition Settings.cpp:171
static auto mouse_grabbed() noexcept -> bool
Is the cursor grabbed.
Definition Settings.cpp:156
static auto cursor_icon() noexcept -> const std::string &
Cursor texture file in vfs.
Definition Settings.cpp:166
Blank "Tag" class/type to signal the window is being closed.
New width and height of window being resized.