]> git.localhorst.tv Git - blank.git/blob - src/app/init.hpp
fancy crosshair
[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 InitTTF {
37
38 public:
39         InitTTF();
40         ~InitTTF();
41
42         InitTTF(const InitTTF &) = delete;
43         InitTTF &operator =(const InitTTF &) = delete;
44
45 };
46
47
48 class InitGL {
49
50 public:
51         explicit InitGL(bool double_buffer = true, int sample_size = 1);
52
53         InitGL(const InitGL &) = delete;
54         InitGL &operator =(const InitGL &) = delete;
55
56 };
57
58
59 class Window {
60
61 public:
62         Window();
63         ~Window();
64
65         Window(const Window &) = delete;
66         Window &operator =(const Window &) = delete;
67
68         void GrabInput();
69         void ReleaseInput();
70
71         void GrabMouse();
72         void ReleaseMouse();
73
74         GLContext CreateContext();
75
76         void Flip();
77
78 private:
79         SDL_Window *handle;
80
81 };
82
83
84 class GLContext {
85
86 public:
87         explicit GLContext(SDL_Window *);
88         ~GLContext();
89
90         GLContext(GLContext &&);
91         GLContext &operator =(GLContext &&);
92
93         GLContext(const GLContext &) = delete;
94         GLContext &operator =(const GLContext &) = delete;
95
96         static void EnableVSync();
97         static void EnableDepthTest() noexcept;
98         static void EnableBackfaceCulling() noexcept;
99         static void EnableAlphaBlending() noexcept;
100         static void EnableInvertBlending() noexcept;
101         static void DisableBlending() noexcept;
102
103         static void Clear() noexcept;
104         static void ClearDepthBuffer() noexcept;
105
106 private:
107         SDL_GLContext handle;
108
109 };
110
111
112 class InitGLEW {
113
114 public:
115         InitGLEW();
116
117         InitGLEW(const InitGLEW &) = delete;
118         InitGLEW &operator =(const InitGLEW &) = delete;
119
120 };
121
122 }
123
124 #endif