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.hpp
Go to the documentation of this file.
1
7
8#ifndef GALAXY_CORE_WINDOW_HPP_
9#define GALAXY_CORE_WINDOW_HPP_
10
11#include <string>
12
13#include <entt/signal/fwd.hpp>
14#include <glm/vec2.hpp>
15#include <SDL3/SDL_events.h>
16#include <SDL3/SDL_video.h>
17
21union SDL_Event;
22
23namespace galaxy
24{
28 class Window final
29 {
30 public:
34 Window();
35
39 ~Window();
40
46 void close() noexcept;
47
51 void clear() noexcept;
52
56 void swap() const noexcept;
57
61 void show() const noexcept;
62
66 void hide() const noexcept;
67
71 void minimize() const noexcept;
72
76 void maximize() const noexcept;
77
81 void restore() const noexcept;
82
86 void raise() const noexcept;
87
91 void request_attention() const noexcept;
92
99 void resize(const int width, const int height) const noexcept;
100
106 void set_fullscreen(const bool fullscreen) const noexcept;
107
113 void set_taskbar_progress(const float progress) noexcept;
114
120 void set_title(const std::string& title);
121
129 void append_title(const std::string& append);
130
136 void set_icon(const std::string& icon) noexcept;
137
143 void handle_window_events(const SDL_Event& events);
144
150 [[nodiscard]]
151 int screen_width() const noexcept;
152
158 [[nodiscard]]
159 int screen_height() const noexcept;
160
166 [[nodiscard]]
167 int virtual_screen_width() const noexcept;
168
174 [[nodiscard]]
175 int virtual_screen_height() const noexcept;
176
182 [[nodiscard]]
183 bool is_open() const noexcept;
184
190 [[nodiscard]]
191 float get_display_scale() const noexcept;
192
198 [[nodiscard]]
199 SDL_Window* handle() const noexcept;
200
206 [[nodiscard]]
207 SDL_GLContext context() const noexcept;
208
209 private:
213 Window(const Window&) = delete;
214
218 Window(Window&&) = delete;
219
223 Window& operator=(const Window&) = delete;
224
228 Window& operator=(Window&&) = delete;
229
230 private:
234 SDL_Window* m_window;
235
239 SDL_GLContext m_context;
240
244 bool m_open;
245 };
246} // namespace galaxy
247
248#endif
SDL_Window * m_window
SDL window handle.
Definition Window.hpp:234
void set_fullscreen(const bool fullscreen) const noexcept
Toggle fullscreen.
Definition Window.cpp:220
int screen_width() const noexcept
Return the current drawable width in pixels.
Definition Window.cpp:305
SDL_Window * handle() const noexcept
Get SDL window pointer.
Definition Window.cpp:335
SDL_GLContext context() const noexcept
Get SDL GL context.
Definition Window.cpp:340
void swap() const noexcept
Swap backbuffer with window framebuffer.
Definition Window.cpp:171
Window(const Window &)=delete
Copy constructor.
bool is_open() const noexcept
Is the window open or closed.
Definition Window.cpp:325
void raise() const noexcept
Raise the window to be on top of other windows.
Definition Window.cpp:205
void resize(const int width, const int height) const noexcept
Resizes window.
Definition Window.cpp:215
Window & operator=(Window &&)=delete
Move assignment operator.
Window()
Window creation constructor.
Definition Window.cpp:31
void maximize() const noexcept
Maximize window.
Definition Window.cpp:193
int virtual_screen_height() const noexcept
Return the configured logical screen height.
Definition Window.cpp:320
int virtual_screen_width() const noexcept
Return the configured logical screen width.
Definition Window.cpp:315
void append_title(const std::string &append)
Append to window title from the settings.
Definition Window.cpp:235
void handle_window_events(const SDL_Event &events)
Process window specific events.
Definition Window.cpp:265
void close() noexcept
Close window.
Definition Window.cpp:161
void set_taskbar_progress(const float progress) noexcept
Sets the taskbar icon progress overlay.
Definition Window.cpp:225
bool m_open
Window state flag.
Definition Window.hpp:244
void hide() const noexcept
Hide window.
Definition Window.cpp:182
SDL_GLContext m_context
SDL OpenGL context.
Definition Window.hpp:239
void show() const noexcept
Show window.
Definition Window.cpp:177
Window(Window &&)=delete
Move constructor.
Window & operator=(const Window &)=delete
Copy assignment operator.
float get_display_scale() const noexcept
Get display content scale.
Definition Window.cpp:330
void minimize() const noexcept
Minimize window.
Definition Window.cpp:187
int screen_height() const noexcept
Return the current drawable height in pixels.
Definition Window.cpp:310
void clear() noexcept
Clear screen framebuffer.
Definition Window.cpp:166
void set_icon(const std::string &icon) noexcept
Set window icon.
Definition Window.cpp:241
void set_title(const std::string &title)
Set window title.
Definition Window.cpp:230
void request_attention() const noexcept
Flash window on taskbar for user attention.
Definition Window.cpp:210
void restore() const noexcept
Restore window to previous *mize state.
Definition Window.cpp:199
Tag.cpp galaxy.
Definition Tag.cpp:13