aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/je_window.h
blob: 7ca1e5e0c5bcc442590dc396ca0ae7e0f4431978 (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
#ifndef __JE_RENDER_WINDOW
#define __JE_RENDER_WINDOW
#include "../core/je_configuration.h"
#if defined(jin_graphics)

#include "SDL2/SDL.h"

#include "../utils/je_utils.h"
#include "../math/je_vector2.hpp"
#include "../common/je_subsystem.hpp"

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

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

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

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

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

            ///
            ///
            ///
			void swapBuffers();

		private:

            // declare a singleton 
			singleton(Window);

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

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

            ///
            ///
            ///
			bool initSystem(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