-
Notifications
You must be signed in to change notification settings - Fork 0
/
Display.h
49 lines (42 loc) · 1.05 KB
/
Display.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
#ifndef DISPLAY_H_
#define DISPLAY_H_
#include "Singleton.hpp"
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <functional>
class Display : public Singleton<Display> {
public:
explicit Display(token);
~Display();
void Init();
void GetSize(int & width, int & height);
void AdjustViewportOffsets();
void SetupViewport();
bool QuitRequested();
void UiMode();
void WorldMode(double scale_factor);
void PreRender();
void PostRender();
void RequestQuit();
void Quit();
void RegisterKeyCallback(std::function<void(int, bool)> cb);
void KeyCallback(int key, bool action);
private:
GLFWwindow * window_;
std::function<void(int, bool)> key_cb_;
double vp_left_;
double vp_right_;
double vp_top_;
double vp_bottom_;
double vp_center_x_;
double vp_center_y_;
double vp_left_offset_;
double vp_right_offset_;
double vp_top_offset_;
double vp_bottom_offset_;
int width_;
int height_;
double size_;
};
#define DISPLAY Display::Instance()
#endif // DISPLAY_H_