summaryrefslogtreecommitdiff
path: root/ui/window.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-12-18 15:08:45 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-12-18 15:08:45 +0000
commitde61720146a1ce0640322dff992462bfbecafdc3 (patch)
tree85caf3c290415b1d7ed6b56341a4be290e69a06a /ui/window.cpp
parentSingle glContext shared between windows (diff)
downloadilt-de61720146a1ce0640322dff992462bfbecafdc3.tar.bz2
ilt-de61720146a1ce0640322dff992462bfbecafdc3.tar.xz
ilt-de61720146a1ce0640322dff992462bfbecafdc3.zip
Push uiShader into the window class
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