aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/render/window.h
blob: f600e35e6002d59d22307f53434a6f28b87c8bd2 (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
57
58
59
60
#ifndef __JIN_RENDER_WINDOW
#define __JIN_RENDER_WINDOW
#include "../modules.h"
#if JIN_MODULES_RENDER

#include <SDL2/SDL.h>
#include "../utils/utils.h"
#include "../common/subsystem.h"

namespace jin
{
namespace render
{

    class WindowSystem : public Subsystem<WindowSystem>
    {
    public: 

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

        inline int getW()
        {
            return width;
        }

        inline int getH()
        {
            return height;
        }

        inline void swapBuffers();

    private:

        WindowSystem() {};
        virtual ~WindowSystem() {};

        SINGLETON(WindowSystem);

        SDL_Window* wnd;

        int width, height;

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

    typedef WindowSystem::Setting WindowSetting;

} // render
} // jin

#endif // JIN_MODULES_RENDER
#endif // __JIN_RENDER_WINDOW