-
Notifications
You must be signed in to change notification settings - Fork 0
/
button.h
94 lines (76 loc) · 2.19 KB
/
button.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
#ifndef BUTTON_H
#define BUTTON_H
#include "My_Headers.h"
#include "opt_window.h"
class BUTTON;
// pass time data to timer thread
struct countID{
int *ID;
float *timeRemain;
};
//For timer thread
struct CountThreadData{
unsigned int Hundredths = 0;
unsigned int seconds = 0;
unsigned int minutes = 0;
bool* quit;
bool finished = false;
std::vector<countID> *ButtonID;
SDL_mutex *counterLock;
Shader *text_shader;
int clearID = 0;
};
struct TextInThreadData{
bool* quit;
};
//Render Flag
extern bool gRenderQuad;
extern bool button_window;
extern bool esc_button;
extern int button_win_ID;
class BUTTON{
public:
std::string label = "Default";
std::string samplePath;
Shader *Button_Body;
Shader *Button_Text;
glm::mat4 model;
glm::mat4 view;
glm::mat4 projection;
glm::vec3 Button_Color = glm::vec3(0.3f, 0.0f, 0.3f); // Purples
glm::vec4 Top_Left = glm::vec4(-0.75f, 0.25f, -0.1f, 1.0f);
glm::vec4 Bottom_Right = glm::vec4(0.75f, -0.25f, -0.1f, 1.0f);
point T_Left, B_Right; // integers bounding boxes for mouse over events
Mix_Chunk *sample = NULL;
float r = 0.0f;
float g = 0.0f;
float b = 0.0f;
float ring = 0.0f;
float press = 0.0f;
float playing = 0.0f;
unsigned int VAO_Body, VAO_BACK, VAOTxt, VBOTxt;
std::vector<unsigned int> VAOVect;
std::map<char, Character> *Characters;
std::vector<countID> *ButtonID;
OPT_WINDOW *Button_Window;
bool prev_visit = false;
int ID;
float sampleDuration = 0.0f;
float timeRemain = 0.0f;
SDL_mutex *counterLock;
// Constructor
BUTTON();
BUTTON(Shader *Body, Shader *Text, std::map<char, Character> *Font_Map);
void init_button();
void draw_button(/*glm::mat4 position*/);
void handleEvent( SDL_Event* e , int &x, int &y);
void handleEvent(bool finished);
private:
void draw_back();
void draw_text();
void draw_body();
void init_back();
void init_text();
void init_body();
};
#endif