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 swap() const noexcept;
52
56 void show() const noexcept;
57
61 void hide() const noexcept;
62
66 void minimize() const noexcept;
67
71 void maximize() const noexcept;
72
76 void restore() const noexcept;
77
81 void raise() const noexcept;
82
86 void request_attention() const noexcept;
87
94 void resize(const int width, const int height) const noexcept;
95
101 void set_fullscreen(const bool fullscreen) const noexcept;
102
108 void set_taskbar_progress(const float progress) noexcept;
109
115 void set_title(const std::string& title);
116
124 void append_title(const std::string& append);
125
131 void set_icon(const std::string& icon) noexcept;
132
138 void handle_window_events(const SDL_Event& events);
139
145 [[nodiscard]]
146 int screen_width() const noexcept;
147
153 [[nodiscard]]
154 int screen_height() const noexcept;
155
161 [[nodiscard]]
162 int virtual_screen_width() const noexcept;
163
169 [[nodiscard]]
170 int virtual_screen_height() const noexcept;
171
177 [[nodiscard]]
178 bool is_open() const noexcept;
179
185 [[nodiscard]]
186 float get_display_scale() const noexcept;
187
193 [[nodiscard]]
194 SDL_Window* handle() const noexcept;
195
201 [[nodiscard]]
202 SDL_GLContext context() const noexcept;
203
204 private:
208 Window(const Window&) = delete;
209
213 Window(Window&&) = delete;
214
218 Window& operator=(const Window&) = delete;
219
223 Window& operator=(Window&&) = delete;
224
225 private:
229 SDL_Window* m_window;
230
234 SDL_GLContext m_context;
235
239 bool m_open;
240 };
241} // namespace galaxy
242
243#endif
SDL_Window * m_window
SDL window handle.
Definition Window.hpp:229
void set_fullscreen(const bool fullscreen) const noexcept
Toggle fullscreen.
Definition Window.cpp:215
int screen_width() const noexcept
Return the current drawable width in pixels.
Definition Window.cpp:281
SDL_Window * handle() const noexcept
Get SDL window pointer.
Definition Window.cpp:311
SDL_GLContext context() const noexcept
Get SDL GL context.
Definition Window.cpp:316
void swap() const noexcept
Swap backbuffer with window framebuffer.
Definition Window.cpp:163
Window(const Window &)=delete
Copy constructor.
bool is_open() const noexcept
Is the window open or closed.
Definition Window.cpp:301
void raise() const noexcept
Raise the window to be on top of other windows.
Definition Window.cpp:199
void resize(const int width, const int height) const noexcept
Resizes window.
Definition Window.cpp:209
Window & operator=(Window &&)=delete
Move assignment operator.
Window()
Window creation constructor.
Definition Window.cpp:29
void maximize() const noexcept
Maximize window.
Definition Window.cpp:185
int virtual_screen_height() const noexcept
Return the configured logical screen height.
Definition Window.cpp:296
int virtual_screen_width() const noexcept
Return the configured logical screen width.
Definition Window.cpp:291
void append_title(const std::string &append)
Append to window title from the settings.
Definition Window.cpp:230
void handle_window_events(const SDL_Event &events)
Process window specific events.
Definition Window.cpp:260
void close() noexcept
Close window.
Definition Window.cpp:158
void set_taskbar_progress(const float progress) noexcept
Sets the taskbar icon progress overlay.
Definition Window.cpp:220
bool m_open
Window state flag.
Definition Window.hpp:239
void hide() const noexcept
Hide window.
Definition Window.cpp:174
SDL_GLContext m_context
SDL OpenGL context.
Definition Window.hpp:234
void show() const noexcept
Show window.
Definition Window.cpp:169
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:306
void minimize() const noexcept
Minimize window.
Definition Window.cpp:179
int screen_height() const noexcept
Return the current drawable height in pixels.
Definition Window.cpp:286
void set_icon(const std::string &icon) noexcept
Set window icon.
Definition Window.cpp:236
void set_title(const std::string &title)
Set window title.
Definition Window.cpp:225
void request_attention() const noexcept
Flash window on taskbar for user attention.
Definition Window.cpp:204
void restore() const noexcept
Restore window to previous *mize state.
Definition Window.cpp:192
Application.hpp galaxy.