summaryrefslogtreecommitdiff
path: root/ui/window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ui/window.cpp')
-rw-r--r--ui/window.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/ui/window.cpp b/ui/window.cpp
index 2dc0c2a..d9e0467 100644
--- a/ui/window.cpp
+++ b/ui/window.cpp
@@ -21,11 +21,16 @@ SDL_GL_CreateContextAndGlewInit(SDL_Window * w)
using GL_Context = std::remove_pointer_t<SDL_GLContext>;
using SDL_GLContextPtr = wrapped_ptrt<GL_Context, SDL_GL_CreateContextAndGlewInit, SDL_GL_DeleteContext>;
-Window::Window(int width, int height, const std::string & title) :
- m_window {title.c_str(), static_cast<int>(SDL_WINDOWPOS_CENTERED), static_cast<int>(SDL_WINDOWPOS_CENTERED), width,
- height, static_cast<Uint32>(SDL_WINDOW_OPENGL)}
+Window::Window(size_t width, size_t height, const std::string & title) :
+ m_window {title.c_str(), static_cast<int>(SDL_WINDOWPOS_CENTERED), static_cast<int>(SDL_WINDOWPOS_CENTERED),
+ static_cast<int>(width), static_cast<int>(height), static_cast<Uint32>(SDL_WINDOW_OPENGL)},
+ uiShader {[this](auto w) {
+ // must call glContent before creating the shader
+ glContext();
+ return w;
+ }(width),
+ height}
{
- glContext();
}
void