]> git.localhorst.tv Git - blank.git/blob - src/app/init.hpp
some code reorganization
[blank.git] / src / app / init.hpp
1 #ifndef BLANK_APP_INIT_HPP_
2 #define BLANK_APP_INIT_HPP_
3
4 #include <SDL.h>
5
6
7 namespace blank {
8
9 class GLContext;
10
11
12 class InitSDL {
13
14 public:
15         InitSDL();
16         ~InitSDL();
17
18         InitSDL(const InitSDL &) = delete;
19         InitSDL &operator =(const InitSDL &) = delete;
20
21 };
22
23
24 class InitIMG {
25
26 public:
27         InitIMG();
28         ~InitIMG();
29
30         InitIMG(const InitIMG &) = delete;
31         InitIMG &operator =(const InitIMG &) = delete;
32
33 };
34
35
36 class InitGL {
37
38 public:
39         explicit InitGL(bool double_buffer = true, int sample_size = 1);
40
41         InitGL(const InitGL &) = delete;
42         InitGL &operator =(const InitGL &) = delete;
43
44 };
45
46
47 class Window {
48
49 public:
50         Window();
51         ~Window();
52
53         Window(const Window &) = delete;
54         Window &operator =(const Window &) = delete;
55
56         void GrabInput();
57         void ReleaseInput();
58
59         void GrabMouse();
60         void ReleaseMouse();
61
62         GLContext CreateContext();
63
64         void Flip();
65
66 private:
67         SDL_Window *handle;
68
69 };
70
71
72 class GLContext {
73
74 public:
75         explicit GLContext(SDL_Window *);
76         ~GLContext();
77
78         GLContext(GLContext &&);
79         GLContext &operator =(GLContext &&);
80
81         GLContext(const GLContext &) = delete;
82         GLContext &operator =(const GLContext &) = delete;
83
84         static void EnableVSync();
85         static void EnableDepthTest() noexcept;
86         static void EnableBackfaceCulling() noexcept;
87
88         static void Clear() noexcept;
89         static void ClearDepthBuffer() noexcept;
90
91 private:
92         SDL_GLContext handle;
93
94 };
95
96
97 class InitGLEW {
98
99 public:
100         InitGLEW();
101
102         InitGLEW(const InitGLEW &) = delete;
103         InitGLEW &operator =(const InitGLEW &) = delete;
104
105 };
106
107 }
108
109 #endif