aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/render/window.h
blob: 515ffff78d14195bcc4a3bc5deef96cb17ff6adc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef __JIN_RENDER_WINDOW
#define __JIN_RENDER_WINDOW
#include "SDL2/SDL.h"
namespace jin
{
namespace render
{
    class Window
    {
    public: 
        
        void init(int w, int h, const char* t);
        
        SDL_Window* getWnd();
        
        SDL_GLContext getCtx(); 
        
        static inline Window* get()
        {
            return (g_wnd ? g_wnd : (g_wnd = new Window()));
        }

        inline int getW()
        {
            return w;
        }

        inline int getH()
        {
            return h;
        }

		inline void swapBuffers();

    private: 

        Window(); 
        ~Window(); 
        
        static Window* g_wnd; 
        
        SDL_Window* wnd; 
        
        SDL_GLContext ctx;
        
        int w, h;
    };
}
}
#endif