From de61720146a1ce0640322dff992462bfbecafdc3 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 18 Dec 2021 15:08:45 +0000 Subject: Push uiShader into the window class --- ui/window.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'ui/window.cpp') 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; using SDL_GLContextPtr = wrapped_ptrt; -Window::Window(int width, int height, const std::string & title) : - m_window {title.c_str(), static_cast(SDL_WINDOWPOS_CENTERED), static_cast(SDL_WINDOWPOS_CENTERED), width, - height, static_cast(SDL_WINDOW_OPENGL)} +Window::Window(size_t width, size_t height, const std::string & title) : + m_window {title.c_str(), static_cast(SDL_WINDOWPOS_CENTERED), static_cast(SDL_WINDOWPOS_CENTERED), + static_cast(width), static_cast(height), static_cast(SDL_WINDOW_OPENGL)}, + uiShader {[this](auto w) { + // must call glContent before creating the shader + glContext(); + return w; + }(width), + height} { - glContext(); } void -- cgit v1.2.3