Gamedev Framework (gf)  0.9.0
A C++14 framework for 2D games
Monitor.h
1 /*
2  * Gamedev Framework (gf)
3  * Copyright (C) 2016-2018 Julien Bernard
4  *
5  * This software is provided 'as-is', without any express or implied
6  * warranty. In no event will the authors be held liable for any damages
7  * arising from the use of this software.
8  *
9  * Permission is granted to anyone to use this software for any purpose,
10  * including commercial applications, and to alter it and redistribute it
11  * freely, subject to the following restrictions:
12  *
13  * 1. The origin of this software must not be misrepresented; you must not
14  * claim that you wrote the original software. If you use this software
15  * in a product, an acknowledgment in the product documentation would be
16  * appreciated but is not required.
17  * 2. Altered source versions must be plainly marked as such, and must not be
18  * misrepresented as being the original software.
19  * 3. This notice may not be removed or altered from any source distribution.
20  */
21 #ifndef GF_MONITOR_H
22 #define GF_MONITOR_H
23 
24 #include <string>
25 #include <vector>
26 
27 #include "Library.h"
28 #include "Portability.h"
29 #include "Vector.h"
30 
31 namespace gf {
32 #ifndef DOXYGEN_SHOULD_SKIP_THIS
33 inline namespace v1 {
34 #endif
35 
41  struct GF_API VideoMode {
43  unsigned bitsPerPixel;
45  };
46 
51  class GF_API Monitor {
52  public:
58  static Monitor getPrimaryMonitor();
59 
63  static std::vector<Monitor> getAvailableMonitors();
64 
68  Monitor(const Monitor&) = delete;
69 
73  Monitor& operator=(const Monitor&) = delete;
74 
78  Monitor(Monitor&& other) = default;
79 
83  Monitor& operator=(Monitor&& other) = default;
84 
90  std::string getName() const;
91 
97  Vector2i getPosition() const;
98 
104  Vector2u getPhysicalSize() const;
105 
111  std::vector<VideoMode> getAvailableVideoModes() const;
112 
118  VideoMode getCurrentVideoMode() const;
119 
120  private:
121  friend class Window;
122 
123  explicit Monitor(int index);
124 
125  Library m_lib; // to automatically initialize SDL
126  int m_index;
127  };
128 
129 #ifndef DOXYGEN_SHOULD_SKIP_THIS
130 }
131 #endif
132 }
133 
134 #endif // GL_MONITOR_H
int refreshRate
Video mode refresh rate, in Hz.
Definition: Monitor.h:44
A video mode.
Definition: Monitor.h:41
The namespace for gf classes.
Definition: Action.h:34
A class to represent the library.
Definition: Library.h:44
An OS window.
Definition: Window.h:88
A monitor.
Definition: Monitor.h:51
unsigned bitsPerPixel
Video mode pixel depth, in bits per pixel.
Definition: Monitor.h:43
Vector2u size
Video mode size, in pixels.
Definition: Monitor.h:42