aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/Window.h
blob: ebd776ee7596eaa6783f877c81951b20c34a5bd6 (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 __LIBJIN_RENDER_WINDOW
#define __LIBJIN_RENDER_WINDOW
#include "../modules.h"
#if LIBJIN_MODULES_RENDER

#include "SDL2/SDL.h"
#include "../utils/utils.h"
#include "../math/Vector2.hpp"
#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
        };

        void setTitle(const char* title);
        inline int getW(){ return size.w; }
        inline int getH(){ return size.h; }
        inline int getFPS(){ return fps; }
        inline void swapBuffers();

    private:
        SINGLETON(Window);

        Window() {};

        virtual ~Window() {};
        bool initSystem(const SettingBase* setting) override;
        void quitSystem() override;

        SDL_Window* wnd;
        jin::math::Vector2<unsigned int> size;
        int fps;

    };

} // render
} // jin

#endif // LIBJIN_MODULES_RENDER
#endif // __LIBJIN_RENDER_WINDOW