aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/graphics/window.h
blob: c279e9b69915d49b5a536b10f47f33b885723f80 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#ifndef __JE_RENDER_WINDOW
#define __JE_RENDER_WINDOW
#include "../core/configuration.h"
#if defined(jin_graphics)

#include "SDL2/SDL.h"

#include "../utils/utils.h"
#include "../math/vector2.hpp"
#include "../common/subsystem.hpp"

namespace JinEngine
{
    namespace Graphics
    {
        /// 
        /// 
        /// 
        class Window 
            : public Subsystem<Window>
        {
        public: 
            /// 
            /// 
            /// 
            struct Setting : SettingBase
            {
            public:
                const char* title; ///< window title 
                const char* icon;  ///< window icon
                bool fullscreen;   ///< full screen
                int width, height; ///< window size
                bool vsync;        ///< vsync
                int fps;           ///< frame per second
                bool resizable;    ///< resizable
            };

            /// 
            /// 
            /// 
            Window() {};

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

            ///
            ///
            ///
            void setTitle(const char* title);

            ///
            ///
            ///
            inline int getW(){ return mSize.w(); }

            ///
            ///
            ///
            inline int getH(){ return mSize.h(); }

            ///
            ///
            ///
            inline int getFPS(){ return mFps; }

            ///
            ///
            ///
            void present();

            ///
            ///
            ///
            inline void hide() { SDL_HideWindow(mWnd); };

            ///
            ///
            ///
            void show() { SDL_ShowWindow(mWnd); };

        private:

            ///
            ///
            ///
            bool startSystem(const SettingBase* setting) override;

            ///
            ///
            ///
            void quitSystem() override;

            SDL_Window* mWnd;
            JinEngine::Math::Vector2<unsigned int> mSize;
            int mFps;

        };

    } // namespace Graphics
} // namespace JinEngine

#endif // jin_graphics

#endif // __JE_RENDER_WINDOW