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{
29 class Window final
30 {
31 public:
35 Window();
36
40 ~Window();
41
47 void close() noexcept;
48
52 void swap() const noexcept;
53
57 void show() const noexcept;
58
62 void hide() const noexcept;
63
67 void minimize() const noexcept;
68
72 void maximize() const noexcept;
73
77 void restore() const noexcept;
78
82 void raise() const noexcept;
83
87 void request_attention() const noexcept;
88
95 void resize(const int width, const int height) const noexcept;
96
102 void set_fullscreen(const bool fullscreen) const noexcept;
103
109 void set_taskbar_progress(const float progress) noexcept;
110
118 void append_title(const std::string& append);
119
125 void set_icon(const std::string& icon) noexcept;
126
132 [[nodiscard]]
133 bool is_open() const noexcept;
134
140 [[nodiscard]]
141 glm::ivec2 get_pixel_size() noexcept;
142
148 [[nodiscard]]
149 float get_display_scale() const noexcept;
150
156 [[nodiscard]]
157 SDL_Window* handle() const noexcept;
158
164 [[nodiscard]]
165 SDL_GLContext context() const noexcept;
166
167 private:
171 Window(const Window&) = delete;
172
176 Window(Window&&) = delete;
177
181 Window& operator=(const Window&) = delete;
182
186 Window& operator=(Window&&) = delete;
187
188 private:
192 SDL_Window* m_window;
193
197 SDL_GLContext m_context;
198
202 bool m_open;
203 };
204} // namespace galaxy
205
206#endif
RAII Window. Handles events, input & display.
Definition Window.hpp:30
SDL_Window * m_window
SDL window handle.
Definition Window.hpp:192
void set_fullscreen(const bool fullscreen) const noexcept
Toggle fullscreen.
Definition Window.cpp:220
~Window()
Destructor.
Definition Window.cpp:154
SDL_Window * handle() const noexcept
Get SDL window pointer.
Definition Window.cpp:279
SDL_GLContext context() const noexcept
Get SDL GL context.
Definition Window.cpp:284
void swap() const noexcept
Swap backbuffer with window framebuffer.
Definition Window.cpp:169
Window(const Window &)=delete
Copy constructor.
bool is_open() const noexcept
Is the window open or closed.
Definition Window.cpp:261
void raise() const noexcept
Raise the window to be on top of other windows.
Definition Window.cpp:204
void resize(const int width, const int height) const noexcept
Resizes window.
Definition Window.cpp:214
Window & operator=(Window &&)=delete
Move assignment operator.
Window()
Window creation constructor.
Definition Window.cpp:27
void maximize() const noexcept
Maximize window.
Definition Window.cpp:190
void append_title(const std::string &append)
Append to window title.
Definition Window.cpp:231
void close() noexcept
Close window.
Definition Window.cpp:164
void set_taskbar_progress(const float progress) noexcept
Sets the taskbar icon progress overlay.
Definition Window.cpp:226
bool m_open
Window state flag.
Definition Window.hpp:202
glm::ivec2 get_pixel_size() noexcept
Get window size in pixels.
Definition Window.cpp:266
void hide() const noexcept
Hide window.
Definition Window.cpp:179
SDL_GLContext m_context
SDL OpenGL context.
Definition Window.hpp:197
void show() const noexcept
Show window.
Definition Window.cpp:174
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:274
void minimize() const noexcept
Minimize window.
Definition Window.cpp:184
void set_icon(const std::string &icon) noexcept
Set window icon.
Definition Window.cpp:237
void request_attention() const noexcept
Flash window on taskbar for user attention.
Definition Window.cpp:209
void restore() const noexcept
Restore window to previous *mize state.
Definition Window.cpp:197
Application.hpp galaxy.