diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-12-18 15:08:45 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-12-18 15:08:45 +0000 |
commit | de61720146a1ce0640322dff992462bfbecafdc3 (patch) | |
tree | 85caf3c290415b1d7ed6b56341a4be290e69a06a /ui/window.cpp | |
parent | Single glContext shared between windows (diff) | |
download | ilt-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.cpp | 13 |
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
|