-
Notifications
You must be signed in to change notification settings - Fork 0
/
UI.h
67 lines (58 loc) · 1.61 KB
/
UI.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
#pragma once
#include <GL/glew.h>
#include <vector>
#include <map>
#include <string>
#include "ShaderProgram.h"
#include "Scene.h"
#include "Texture.h"
#include "Sound.h"
struct TimedMessage {
std::string txt;
float timeRemaining;
};
class UI {
public:
UI(Scene *scene, AudioDevice &audioDevice);
~UI();
void draw();
void setFbSize(int fbWidth, int fbHeight);
// scale is a multiple of the size in the texture, scale = 1 is 10*16 pixels
void addText(const std::string &txt, float left, float bot, float scale);
void tick(float dt);
void setFps(float fps) { m_fps = fps; }
void addMessage(float duration, const std::string &key, const std::string& s);
void setShowCrosshiars(bool show) { m_showCrosshairs = show; }
void toggleShowHint() { m_showHint = !m_showHint; }
bool getShowHint() { return m_showHint; }
void changeHint(bool dir);
void pickTarget();
private:
Texture m_texFont;
ShaderProgram m_prog, m_textProg;
Scene* m_scene;
GLuint m_vao, m_vbo;
GLuint m_textVbo, m_textVao;
float m_aspectRatio;
int m_fbWidth, m_fbHeight;
std::vector<float> m_textData;
const int m_textDataVboSize; // size in floats
const float m_clockSize = 0.15f;
const int m_clockSubdivisions;
int m_clockTickOffset;
float m_fps;
float m_fpsTimer;
std::string m_fpsString;
std::map<std::string, TimedMessage> m_messages;
bool m_showCrosshairs;
int m_crosshairsOffset;
int m_checkboxOffset;
std::vector<uint> m_requiredIds;
std::vector<bool> m_foundObjects;
bool m_showHint;
uint m_hintIdx;
std::vector<std::string> m_hints;
AudioDevice& m_audioDevice;
Sound m_failSound, m_passSound;
float m_timeSinceLastSound;
};