-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwindow.hpp
368 lines (356 loc) · 11.3 KB
/
window.hpp
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
#ifndef SRE_WINDOW_HPP
#define SRE_WINDOW_HPP
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
#include <string>
#include <map>
#include "hints.hpp"
#include "monitor.hpp"
namespace sre
{
using glm::ivec2;
// !! temp !!
class Window
{
GLFWwindow * window;
public:
// static methods
static void init();
// constructors
Window ( GLFWwindow * window );
Window ( const int width=640, const int height=480,
const std::string & title="OpenGL",
const Hints & hints = DefaultHints(),
const Monitor & monitor = Monitor( nullptr ),
const Window & share = Window( nullptr ) );
// get
GLFWwindow * getGLFWwindow();
ivec2 getFramebufferSize() const;
ivec2 getPos () const;
ivec2 getSize () const;
bool exists () const;
int shouldClose () const;
// set
void setTitle( const std::string & title);
void setPos ( int xPos, int yPos );
void setPos ( const ivec2 & pos);
void setSize ( int width, int height );
void setSize ( const ivec2 & size );
// set command
void makeActive ();
void iconify ();
void restore ();
void show ();
void hide ();
int shouldClose ( int gl_tf );
void swapBuffers ();
// callbacks
};
}
#endif // WINDOW_HPP
//#ifndef WINDOW_HPP_INCLUDED
//#define WINDOW_HPP_INCLUDED
//
//
//#include <GLFW/glfw3.h>
//
//#include <string>
//
//
//namespace sre //Stupit? Rendering Engine
//{
// class VideoMode;
// class GammaRamp;
// class Monitor;
// class Window;
// class WindowSettings;
// class FrameBufferSettings;
// class ContextSettings;
//
// class VideoMode
// {
// GLFWvidmode * vidMode;
//
// public:
// VideoMode ( Monitor * monitor );
// VideoMode ( VideoMode * videoMode );
// VideoMode ( const GLFWvidmode * vidmode);
//
// void setWidth ( int width );
// void setHeight ( int height );
// void setRedBits ( int redBits );
// void setGreenBits ( int greenBits );
// void setBlueBits ( int blueBits );
// void setRefreshRate ( int refreshRate );
//
// int getWidth () const;
// int getHeight () const;
// int getRedBits () const;
// int getGreenBits () const;
// int getBlueBits () const;
// int getRefreshRate () const;
// };
//
// class GammaRamp
// {
//
// };
//
// /** \brief
// *
// *
// */
// class Monitor
// {
// GLFWmonitor * monitor;
// int posXY[2];
// int physSize[2];
// std::string name;
//
//
//
// public:
// Monitor ();
// Monitor ( GLFWmonitor * monitor);
//
// // get
// int * getPos ();
// int * getPhysicalSize ();
// VideoMode getVideoMode () const;
// GammaRamp getGammaRamp () const;
// GLFWmonitor * getGLFWMonitor () const;
//
// // static
// static Monitor getPrimary();
// };
//
// class Settings
// {
// public:
// void apply() const;
// };
//
// class WindowSettings : private Settings
// { // http://www.glfw.org/docs/3.0/window.html for default values
// bool resizable = true;
// bool visible = true;
// bool decorated = true;
// public:
// WindowSettings () {}
// WindowSettings ( bool resizable, bool visible, bool decorated )
// {
// setResizable( resizable );
// setVisible ( visible );
// setDecorated ( decorated );
// }
//
// void setResizable( bool resizable ) { this->resizable = resizable; }
// void setVisible ( bool visible ) { this->visible = visible; }
// void setDecorated ( bool tf ) { this->decorated = decorated; }
//
// bool isResizable() const { return resizable; }
// bool isVisible() const { return visible; }
// bool isDecorated() const { return decorated; }
//
// //other
// void apply() const;
// };
//
// class FrameBufferSettings : private Settings
// { // http://www.glfw.org/docs/3.0/window.html for default values
// int redBits = 8, greenBits = 8, blueBits = 8;
// int alphaBits = 8;
// int depthBits = 24;
// int stencilBits = 8;
//
// int accumRedBits = 0, accumGreenBits = 0, accumBlueBits = 0;
// int accumAlphaBits = 0;
// int auxBuffers = 0;
// int samples = 0;
// int refreshRate = 0;
//
// bool stereo = false;
// bool sRGBCapable = false;
//
// public:
// FrameBufferSettings () {}
//
// int getRedBits () const { return redBits; }
// int getGreenBits() const { return greenBits; }
// int getBlueBits () const { return blueBits; }
// int getAlphaBits () const { return alphaBits; }
// int getDepthBits () const { return depthBits; }
// int getStencilBits () const { return stencilBits; }
//
// int getAccumRedBits () const { return accumRedBits; }
// int getAccumGreenBits () const { return accumGreenBits; }
// int getAccumBlueBits () const { return accumBlueBits; }
// int getAccumAlphaBits () const { return accumAlphaBits; }
//
// int getAuxBuffers () const { return auxBuffers; }
// int getSamples () const { return samples; }
// int getRefreshRate () const { return refreshRate; }
//
// bool isStereo () const { return stereo; }
// bool isSRGBCapable () const { return sRGBCapable; }
//
// void setRedBits ( int redBits ) { this->redBits = redBits; }
// void setGreenBits ( int greenBits ) { this->greenBits = greenBits; }
// void setBlueBits ( int blueBits ) { this->blueBits = blueBits; }
// void setAlphaBits ( int alphaBits ) { this->alphaBits = alphaBits; }
// void setDepthBits ( int depthBits ) { this->depthBits = depthBits; }
// void setStencilBits ( int stencilBits ) { this->stencilBits = stencilBits; }
//
// void setAccumRedBits ( int accumRedBits ) { this->accumRedBits = accumRedBits; }
// void setAccumGreenBits ( int accumGreenBits ) { this->accumGreenBits = accumGreenBits; }
// void setAccumBlueBits ( int accumBlueBits ) { this->accumBlueBits = accumBlueBits; }
// void setAccumAlphaBits ( int alphaBits ) { this->alphaBits = alphaBits; }
//
// void setAuxBuffers ( int auxBuffers ) { this->auxBuffers = auxBuffers; }
// void setSamples ( int samples ) { this->samples = samples; }
// void setRefreshRate ( int refreshRate ) { this->refreshRate = refreshRate; }
//
// void setStereo ( bool stereo ) { this->stereo = stereo; }
// void setSRGBCapable ( bool sRGBCapable ) { this->sRGBCapable = sRGBCapable; }
//
// //other
// void apply() const;
// };
//
// class ContextSettings : private Settings
// { // http://www.glfw.org/docs/3.0/window.html for default values
// enum API
// {
// GL,
// GL_ES
// };
// API api = GL;
//
// int versionMajor = 1;
// int versionMinor = 0;
//
// enum ROBUSTNESS
// {
// NO_ROBUSTNESS,
// NO_RESET_NOTIFICATION,
// LOSE_CONTEXT_ON_RESET
// };
// ROBUSTNESS robustness = NO_ROBUSTNESS;
//
// bool forwardCompat = false;
// bool debugContext = false;
//
// enum PROFILE
// {
// ANY_PROFILE,
// COMPAT_PROFILE,
// CORE_PROFILE
// };
// PROFILE profile = ANY_PROFILE;
//
// public:
// ContextSettings () {}
//
// // set
// void setAPIGL () { api = GL; }
// void setAPIGLES () { api = GL_ES; }
//
// void setVersionMajor ( int versionMajor ) { this->versionMajor = versionMajor; }
// void setVersionMinor ( int versionMinor ) { this->versionMinor = versionMinor; }
//
// void setNoRobustness () { robustness = NO_ROBUSTNESS; }
// void setNoResetNotification () { robustness = NO_RESET_NOTIFICATION; }
// void setLoseContextOnReset () { robustness = LOSE_CONTEXT_ON_RESET; }
//
// void setForwardCompat ( bool forwardCompatible ) { this->forwardCompat = forwardCompatible; }
// void setDebugContext ( bool debugContext ) { this->debugContext = debugContext; }
//
// void setProfileAny () { this->profile = ANY_PROFILE; }
// void setProfileCompat () { this->profile = COMPAT_PROFILE; }
// void setProfileCore () { this->profile = CORE_PROFILE; }
//
// // get
// bool isAPIGL () const { return (this->api == GL); }
// bool isAPIGLES () const { return (this->api == GL_ES); }
//
// int getVersionMajor () const { return this->versionMajor; }
// int getVersionMinor () const { return this->versionMinor; }
//
// bool isNoRobustness () const { return (this->robustness == NO_ROBUSTNESS); }
// bool isNoResetNotification () const { return (this->robustness == NO_RESET_NOTIFICATION); }
// bool isLoseContextOnReset () const { return( this->robustness == LOSE_CONTEXT_ON_RESET); }
//
// bool isForwardCompatible () const { return forwardCompat; }
// bool isDebugContext () const { return debugContext; }
//
// bool isProfileAny () const { return (this->profile == ANY_PROFILE); }
// bool isProfileCompat () const { return (this->profile == COMPAT_PROFILE); }
// bool isProfileCore () const { return (this->profile == CORE_PROFILE); }
//
// //other
// void apply() const;
// };
//
// /** \brief Abstraction of GLFW window structure and functions
// *
// *
// */
// class Window
// {
// GLFWwindow * window;
//
// int width, height;
// int x, y;
// std::string title;
// Monitor monitor;
// WindowSettings windowSettings;
// FrameBufferSettings frameBufferSettings;
// ContextSettings contextSettings;
//
// // apply settings to window's context
// void apply ();
// void applyWindowSettings () const;
// void applyFrameBufferSettings () const;
// void applyContextSettings() const;
//
// Window (GLFWwindow * window);
// public:
// Window (int width=640, int height=480, std::string title="OpenGL" , Monitor monitor=Monitor::getPrimary() );
// // set
// void setWindowPos ( int xpos, int ypos );
// void setWindowPosX ( int xpos );
// void setWindowPosY ( int ypos );
// void setWindowSize ( int width, int height);
// void setWindowWidth ( int width );
// void setWindowHeight ( int height );
//
// void setWindowShouldClose ( bool tf );
//
// //get
// bool isFocused () const;
// bool isIconified () const;
// bool isResizable () const;
// bool isDecorated () const;
//
// //int getWindowPos ();
// int getWindowPosX ();
// int getWindowPosY ();
// //int getWindowSize ();
// int getWindowWidth ();
// int getWindowHeight ();
//
// int getFrameBufferSizeX ();
// int getFrameBufferSizeY ();
//
// bool windowShouldClose () const;
//
// // other
// void swapBuffers();
// void setActive(); //makes the Window's context the current context
//
// // static
// Window getActive(); //returns active Window
// };
//}
//
//#endif // WINDOW_HPP_INCLUDED