aboutsummaryrefslogtreecommitdiff
path: root/src/render/window.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-05-16 19:19:03 +0800
committerchai <chaifix@163.com>2018-05-16 19:19:03 +0800
commitd45064be602c3becb046d86913ea8013774b0079 (patch)
tree5e2e995c2139b934ed50f75d0a31eae7180aab59 /src/render/window.h
parentfdaf0e7eb6b9d9bdd7d5ab5f814f4ebbf791ff67 (diff)
v0.1.0
Diffstat (limited to 'src/render/window.h')
-rw-r--r--src/render/window.h23
1 files changed, 18 insertions, 5 deletions
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();