aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/render/window.h
blob: 0c2c79d49c5e045cb0bea29ff6bb806700b3a8c4 (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
51
52
53
54
55
56
#ifndef __JIN_RENDER_WINDOW
#define __JIN_RENDER_WINDOW
#include <SDL2/SDL.h>
#include "../utils/utils.h"
#include "../common/subsystem.h"

namespace jin
{
namespace render
{

    class Window : public Subsystem<Window>
    {
    public: 

        struct Setting : SettingBase
        {
        public:
            int width, height; // ڴС 
            bool vsync;        // ֱͬ
            const char* title; // 
        };

        SDL_Window* getWnd();
        
        SDL_GLContext getCtx(); 
        
        inline int getW()
        {
            return width;
        }

        inline int getH()
        {
            return height;
        }

        inline void swapBuffers();

    private:

        SDL_Window* wnd;

        SDL_GLContext ctx;
        
        int width, height;

        onlyonce bool initSystem(const SettingBase* setting) override;
        onlyonce void quitSystem() override;
    };

    typedef Window::Setting WindowSetting;

}
}
#endif