diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-04-08 02:32:39 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-04-08 02:32:39 +0100 |
commit | c6fb8dd64e0c323e46c73162e21a3a34103bb407 (patch) | |
tree | 89b3d5963a83bcf8bc6e49029e1ac3bb7d46b191 /ui | |
parent | Create WindowContent with a size object (diff) | |
download | ilt-c6fb8dd64e0c323e46c73162e21a3a34103bb407.tar.bz2 ilt-c6fb8dd64e0c323e46c73162e21a3a34103bb407.tar.xz ilt-c6fb8dd64e0c323e46c73162e21a3a34103bb407.zip |
Create Windows with a size object
Not individual width/height parameters.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/mainWindow.cpp | 2 | ||||
-rw-r--r-- | ui/mainWindow.h | 3 | ||||
-rw-r--r-- | ui/window.cpp | 3 | ||||
-rw-r--r-- | ui/window.h | 3 |
4 files changed, 4 insertions, 7 deletions
diff --git a/ui/mainWindow.cpp b/ui/mainWindow.cpp index 8d46d43..57dabc0 100644 --- a/ui/mainWindow.cpp +++ b/ui/mainWindow.cpp @@ -8,7 +8,7 @@ #include "backends/imgui_impl_sdl2.h" #pragma GCC diagnostic pop -MainWindow::MainWindow(size_t w, size_t h, const char * title, Uint32 flags) : Window {w, h, title, flags} +MainWindow::MainWindow(ScreenAbsCoord size, const char * title, Uint32 flags) : Window {size, title, flags} { if (const auto version = gladLoadGL(reinterpret_cast<GLADloadfunc>(SDL_GL_GetProcAddress)); version < 30003) { throw std::runtime_error {std::format("Insufficient OpenGL version: {}", version)}; diff --git a/ui/mainWindow.h b/ui/mainWindow.h index 490ef09..d2de9b3 100644 --- a/ui/mainWindow.h +++ b/ui/mainWindow.h @@ -5,8 +5,7 @@ class MainWindow : public Window { public: - MainWindow( - size_t width, size_t height, const char * title, Uint32 flags = SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL); + MainWindow(ScreenAbsCoord size, const char * title, Uint32 flags = SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL); ~MainWindow() override; NO_MOVE(MainWindow); diff --git a/ui/window.cpp b/ui/window.cpp index 3d4634e..06857b2 100644 --- a/ui/window.cpp +++ b/ui/window.cpp @@ -7,8 +7,7 @@ #include "backends/imgui_impl_sdl2.h" #pragma GCC diagnostic pop -Window::Window(size_t width, size_t height, const char * title, Uint32 flags) : - size {static_cast<int>(width), static_cast<int>(height)}, +Window::Window(ScreenAbsCoord size, const char * title, Uint32 flags) : m_window {title, static_cast<int>(SDL_WINDOWPOS_CENTERED), static_cast<int>(SDL_WINDOWPOS_CENTERED), size.x, size.y, flags}, glContext {m_window} diff --git a/ui/window.h b/ui/window.h index 1c3d09c..99a977f 100644 --- a/ui/window.h +++ b/ui/window.h @@ -15,7 +15,7 @@ using SDL_GLContextPtr = wrapped_ptrt<GL_Context, SDL_GL_CreateContext, SDL_GL_D class Window { public: - Window(size_t width, size_t height, const char * title, Uint32 flags); + Window(ScreenAbsCoord size, const char * title, Uint32 flags); virtual ~Window() = default; NO_COPY(Window); @@ -39,7 +39,6 @@ public: protected: void clear(float r, float g, float b, float a) const; - const ScreenAbsCoord size; SDL_WindowPtr m_window; SDL_GLContextPtr glContext; WindowContent::Ptr content; |