Voxellancer  0.3
A game about voxels in space
 All Classes Functions Pages
contextprovider.h
1 #pragma once
2 
3 #include <unordered_set>
4 #include <vector>
5 
6 #include "etc/contextdependant.h"
7 #include "geometry/size.h"
8 #include "geometry/viewport.h"
9 
10 struct GLFWmonitor;
11 
18 public:
19  static ContextProvider* instance();
20 
21  void setRequiredGLVersion(int majorVersionRequire, int minorVersionRequire);
22 
23  void initWindowed();
24  void initWindowed(const Size<int>& resolution);
25  void initWindowed(const Size<int>& resolution, const Size<int>& position);
26  void initFullScreen(int monitorIndex = 0);
27 
28  void toggleFullScreen();
29  void shutdown();
30 
31  bool fullScreen() const;
32  Size<int> resolution() const;
33  Viewport viewport() const;
34  float aspectRatio() const;
35 
36  std::vector<GLFWmonitor*> monitors() const;
37  int currentMonitor() const;
38 
39  void registerContextDependant(ContextDependant* dependant);
40  void unregisterContextDependant(ContextDependant* dependant);
41 
42 
43 protected:
44  static ContextProvider* s_instance;
45 
46  std::unordered_set<ContextDependant*> m_contextDependants;
47 
48  bool m_fullScreen;
49 
50  int m_majorVersionRequire;
51  int m_minorVersionRequire;
52  int m_lastFullScreenMonitorIndex;
53 
54  Size<int> m_lastWindowedPos;
55  Size<int> m_lastWindowedSize;
56 
57 
59  Size<int> currentResolution(GLFWmonitor* monitor);
60  void setWindowHints();
61 };
62 
Definition: viewport.h:6
Definition: contextdependant.h:7
Definition: contextprovider.h:17