]> git.localhorst.tv Git - gong.git/blob - src/app/init.hpp
code, assets, and other stuff stolen from blank
[gong.git] / src / app / init.hpp
1 #ifndef GONG_APP_INIT_HPP_
2 #define GONG_APP_INIT_HPP_
3
4 #include "error.hpp"
5
6 #include <SDL.h>
7
8
9 namespace gong {
10 namespace app {
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 InitVideo {
25
26 public:
27         InitVideo();
28         ~InitVideo();
29
30         InitVideo(const InitVideo &) = delete;
31         InitVideo &operator =(const InitVideo &) = delete;
32
33 };
34
35
36 class InitIMG {
37
38 public:
39         InitIMG();
40         ~InitIMG();
41
42         InitIMG(const InitIMG &) = delete;
43         InitIMG &operator =(const InitIMG &) = delete;
44
45 };
46
47
48 class InitNet {
49
50 public:
51         InitNet();
52         ~InitNet();
53
54         InitNet(const InitNet &) = delete;
55         InitNet &operator =(const InitNet &) = delete;
56
57 };
58
59
60 class InitTTF {
61
62 public:
63         InitTTF();
64         ~InitTTF();
65
66         InitTTF(const InitTTF &) = delete;
67         InitTTF &operator =(const InitTTF &) = delete;
68
69 };
70
71
72 class InitAL {
73
74 public:
75         InitAL();
76         ~InitAL() throw(AlutError);
77
78         InitAL(const InitAL &) = delete;
79         InitAL &operator =(const InitAL &) = delete;
80
81 };
82
83
84 class InitGL {
85
86 public:
87         explicit InitGL(bool double_buffer = true, int sample_size = 1);
88
89         InitGL(const InitGL &) = delete;
90         InitGL &operator =(const InitGL &) = delete;
91
92 };
93
94
95 class Window {
96
97 public:
98         Window();
99         ~Window();
100
101         Window(const Window &) = delete;
102         Window &operator =(const Window &) = delete;
103
104         void GrabInput();
105         void ReleaseInput();
106
107         void GrabMouse();
108         void ReleaseMouse();
109
110         SDL_Window *Handle() { return handle; }
111
112         void Flip();
113
114 private:
115         SDL_Window *handle;
116
117 };
118
119
120 class GLContext {
121
122 public:
123         explicit GLContext(SDL_Window *);
124         ~GLContext();
125
126         GLContext(const GLContext &) = delete;
127         GLContext &operator =(const GLContext &) = delete;
128
129 private:
130         SDL_GLContext ctx;
131
132 };
133
134
135 class InitGLEW {
136
137 public:
138         InitGLEW();
139
140         InitGLEW(const InitGLEW &) = delete;
141         InitGLEW &operator =(const InitGLEW &) = delete;
142
143 };
144
145
146 struct InitHeadless {
147
148         InitHeadless();
149
150         InitSDL init_sdl;
151         InitNet init_net;
152
153 };
154
155 struct Init {
156
157         Init(bool double_buffer = true, int sample_size = 1);
158
159         InitVideo init_video;
160         InitIMG init_img;
161         InitTTF init_ttf;
162         InitAL init_al;
163         InitGL init_gl;
164         Window window;
165         GLContext ctx;
166         InitGLEW init_glew;
167
168 };
169
170 }
171 }
172
173 #endif