-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmonitor.h
120 lines (100 loc) · 2.6 KB
/
monitor.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
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
#ifndef GLFWW_MONITOR_H
#define GLFWW_MONITOR_H
#include <vector>
#include <string>
#include "defs.h"
namespace glfwW
{
/*!
* \brief The video mode of a monitor
*/
struct VideoMode
{
VideoMode() = default;
explicit VideoMode(const GLFWvidmode& mode):
width(mode.width),
height(mode.height),
redBits(mode.redBits),
greenBits(mode.greenBits),
blueBits(mode.blueBits),
refreshRate(mode.refreshRate)
{}
/*!
* \brief width (in screen coordinates)
*/
int width = 0;
/*!
* \brief height (in screen coordinates)
*/
int height = 0;
/*!
* \brief The bit depth of the red channel
*/
int redBits = 0;
/*!
* \brief The bit depth of the green channel
*/
int greenBits = 0;
/*!
* \brief The bit depth of the blue channel
*/
int blueBits = 0;
/*!
* \brief The refresh rate (in Hz)
*/
int refreshRate = 0;
};
/*!
* \brief A monitor object represents a currently connected monitor
*/
class Monitor
{
friend class GLFWlibrary;
friend class Window;
public:
Monitor(GLFWmonitor* descriptor = nullptr): m_monitor(descriptor){}
/*!
* \brief Returns current video mode.
*/
VideoMode getVideoMode() const;
/*!
* \brief Returns available video modes for the monitor.
*/
std::vector<VideoMode> getVideoModes() const;
/*!
* \brief Returns the physical size of a monitor in millimetres.
* ! This has no relation to its current resolution, i.e. the width and height of its current video mode.
*/
Vec2<int> getPhysicalSize() const;
/*!
* \brief The content scale is the ratio between the current DPI and the platform's default DPI.
*/
Vec2<float> getContentScale() const;
/*!
* \brief Returns the position of the monitor on the virtual desktop (in screen coordinates).
*/
Vec2<int> getPosition() const;
/*!
* \brief Returns the area of a monitorwhich is not occupied by global task bars or menu bars (in screen coordinates);
*/
Rect<int> getWorkArea() const;
/*!
* \brief Returns a human-readable, UTF-8 encoded name of the monitor.
*/
std::string getName() const;
/*!
* \brief Sets user pointer.
*/
void setUserPointer(void* pointer);
/*!
* \brief Returns a pointer, assosiated with this monitor.
*/
void* getUserPointer() const;
GLFWmonitor* getHandler() const {return m_monitor;}
bool isValid() const {return m_monitor;}
//TODO gamma ramp
private:
GLFWmonitor* m_monitor = nullptr;
};
}
#endif