-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWindow.h
53 lines (44 loc) · 1.25 KB
/
Window.h
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
#pragma once
#include <stdinc.h>
enum EWindowMode {
EWindowMode_Fullscreen,
EWindowMode_WindowedFullscreen,
EWindowMode_Windowed,
};
enum EVsyncMode {
EVsyncMode_Adaptive = -1, // GSYNC/Freesync and related technologoes.
EVsyncMode_Off, // Vsync off
EVsyncMode_On, // Vsync on
};
class Window {
public:
unsigned int width = 0;
unsigned int height = 0;
GLFWwindow *window;
GLFWmonitor *monitor;
// const GLFWvidmode *vidmode;
EWindowMode mode;
EVsyncMode vsMode = EVsyncMode_Adaptive;
std::string title;
Window(EWindowMode mode) : mode(mode) {};
Window(EWindowMode mode, unsigned int width, unsigned int height)
: mode(mode), width(width), height(height) {};
~Window(){};
Window create();
Window changeMode(EWindowMode mode);
Window changeResolution(unsigned int width, unsigned int height);
Window setOpenGLVersion(int major, int minor);
Window setRefreshRate(int rate);
Window syncMonitor();
Window setVsyncMode(EVsyncMode mode);
Window setTitle(std::string title);
Window resetWindow();
private:
static bool _inited;
bool _windowCreated = false;
void _resizeHandler();
void _errorHandler();
void _createWindowed();
void _createFullscreen();
void _createFullscreenWindowed();
};