diff options
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/window.cpp | 28 | ||||
-rw-r--r-- | src/render/window.h | 23 |
2 files changed, 22 insertions, 29 deletions
diff --git a/src/render/window.cpp b/src/render/window.cpp index a12c92f..a929057 100644 --- a/src/render/window.cpp +++ b/src/render/window.cpp @@ -1,18 +1,14 @@ #include "window.h" #include "libs/GLee/GLee.h" #include "canvas.h" +#include "utils/macros.h" namespace jin { namespace render { - Window* Window::g_wnd = 0; - - Window* Window::get() - { - return (g_wnd ? g_wnd : (g_wnd = new Window())); - } - + shared Window* Window::g_wnd = 0; + Window::Window(): wnd(0), ctx(0) { } @@ -44,7 +40,7 @@ namespace render SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8); - Uint32 flags = SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL; + Uint32 flags = SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL ; int wx = SDL_WINDOWPOS_UNDEFINED, wy = SDL_WINDOWPOS_UNDEFINED; @@ -83,21 +79,5 @@ namespace render return ctx; } - int Window::getW() - { - return w; - } - - int Window::getH() - { - return h; - } - - void Window::swapBuffers() - { - if (wnd) - SDL_GL_SwapWindow(wnd); - } - } }
\ No newline at end of file diff --git a/src/render/window.h b/src/render/window.h index 79b9eb3..f29c82d 100644 --- a/src/render/window.h +++ b/src/render/window.h @@ -15,13 +15,26 @@ namespace render SDL_GLContext getCtx(); - static Window* get(); + static inline Window* get() + { + return (g_wnd ? g_wnd : (g_wnd = new Window())); + } - int getW(); - int getH(); - - void swapBuffers(); + inline int Window::getW() + { + return w; + } + + inline int Window::getH() + { + return h; + } + inline void Window::swapBuffers() + { + if (wnd) + SDL_GL_SwapWindow(wnd); + } private: Window(); |