aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/Window.h
blob: e4939f697fcb5a2dda15da6d42386f232e9a145c (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
#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.hpp"

namespace jin
{
namespace graphics
{

    class Window : public Subsystem<Window>
    {
    public: 

        struct Setting : SettingBase
        {
        public:
            const char* title; // 
            bool fullscreen;   // ȫ
            int width, height; // ڴС 
            bool vsync;        // ֱͬ
            int fps;           // FPS
            bool resizable;    // resize
        };

        inline int getW(){ return width; }
        inline int getH(){ return height; }
        inline int getFPS(){ return fps; }
        inline void swapBuffers();

    private:

        Window() {};
        virtual ~Window() {};

        SINGLETON(Window);

        SDL_Window* wnd;

        int width, height;
        int fps;

        /*call only once*/ bool initSystem(const SettingBase* setting) override;
		/*call only once*/ void quitSystem() override;
    };

} // render
} // jin

#endif // JIN_MODULES_RENDER
#endif // __JIN_RENDER_WINDOW