-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgl.h
More file actions
106 lines (94 loc) · 1.86 KB
/
gl.h
File metadata and controls
106 lines (94 loc) · 1.86 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
#ifndef _XGL_H
#define _XGL_H
#include <cstring>
#include <iostream>
#include <exception>
#include <vector>
using namespace std;
template<class T>
struct Point
{
T x;
T y;
};
template<class T>
struct Rect
{
T left;
T top;
union{T width; T right; };
union{T height; T bottom; };
};
class Shader
{
unsigned int vert_shader;
unsigned int frag_shader;
public:
unsigned int id;
Shader() = default;
Shader(string,string);
void Load();
~Shader();
};
class ShaderException: public exception
{
private:
string msg;
public:
ShaderException(string m="Shader Exception"): msg(m) {}
~ShaderException() throw() {}
const char* what() const throw() { return msg.c_str(); }
};
class GLSave
{
private:
unsigned int vao;
unsigned int vbo;
unsigned int eao;
unsigned int program;
unsigned int active_texture;
bool blend;
bool depth;
bool stencil;
public:
GLSave();
~GLSave();
};
class Text
{
private:
unsigned int text_vao;
unsigned int vertex_buffer;
unsigned int tex_buffer;
unsigned int texture;
unsigned char *tex_pixels;
int tex_width;
int tex_height;
unsigned int shader_program;
unsigned int vert;
unsigned int frag;
public:
Text();
void Draw(float x, float y, float size, string s);
~Text();
};
class ImageMenu
{
private:
unsigned int vao;
unsigned int vertex_buffer;
unsigned int tex_buffer;
unsigned char *tex_pixels;
int tex_width;
int tex_height;
unsigned int texture;
Shader *shader;
Rect<float> boundary;
vector<Rect<float> > option_coords;
public:
ImageMenu(string, int window_width, int window_height, Rect<int> Boundary, vector<Rect<int> > Option_coords);
void DrawMenu(bool translucent = false);
int ProcessInput(float x, float y);
~ImageMenu();
};
#endif // _GL_H