-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.h
115 lines (96 loc) · 3.41 KB
/
main.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#ifndef MAIN_H
#define MAIN_H
#include <iostream>
#include <cmath>
#include <fstream>
#include <vector>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtx/transform.hpp>
#include <glm/gtc/matrix_transform.hpp>
struct color_t {
int r;
int g;
int b;
};
// nonedit.cpp
GLFWwindow *initGLFW(int width, int height);
GLuint LoadShaders(const char *vertex_file_path, const char *fragment_file_path);
struct VAO *create3DObject(GLenum primitive_mode, int numVertices, const GLfloat *vertex_buffer_data, const GLfloat *color_buffer_data, GLenum fill_mode = GL_FILL);
struct VAO *create3DObject(GLenum primitive_mode, int numVertices, const GLfloat *vertex_buffer_data, const GLfloat red, const GLfloat green, const GLfloat blue, GLenum fill_mode = GL_FILL);
struct VAO *create3DObject(GLenum primitive_mode, int numVertices, const GLfloat *vertex_buffer_data, const color_t color, GLenum fill_mode = GL_FILL);
void draw3DObject(struct VAO *vao);
// input.cpp
void keyboard(GLFWwindow *window, int key, int scancode, int action, int mods);
void keyboardChar(GLFWwindow *window, unsigned int key);
void mouseButton(GLFWwindow *window, int button, int action, int mods);
void scroll_callback(GLFWwindow *window, double xoffset, double yoffset);
// other_handlers.cpp
void error_callback(int error, const char *description);
void quit(GLFWwindow *window);
void reshapeWindow(GLFWwindow *window, int width, int height);
// Types
struct VAO {
GLuint VertexArrayID;
GLuint VertexBuffer;
GLuint ColorBuffer;
GLenum PrimitiveMode;
GLenum FillMode;
int NumVertices;
};
typedef struct VAO VAO;
struct GLMatrices {
glm::mat4 projection;
glm::mat4 model;
glm::mat4 view;
GLuint MatrixID;
};
extern GLMatrices Matrices;
// ---- Logic ----
enum direction_t { DIR_UP, DIR_RIGHT, DIR_DOWN, DIR_LEFT };
struct bounding_box_t {
float x;
float y;
float z;
};
bool detect_collision_rock(bounding_box_t a, bounding_box_t b);
bool detect_collision_barrel(bounding_box_t a, bounding_box_t b);
bool detect_collision_boat(bounding_box_t a, bounding_box_t b);
bool detect_collision_gift(bounding_box_t a, bounding_box_t b);
bool detect_collision_boost(bounding_box_t a, bounding_box_t b);
bool detect_collision_monster(bounding_box_t a, bounding_box_t b);
bool detect_collision_cannon(bounding_box_t a, bounding_box_t b);
bool detect_collision_boss(bounding_box_t a, bounding_box_t b);
extern float screen_zoom, screen_center_x, screen_center_y;
void reset_screen();
// ---- Colors ----
extern const color_t COLOR_YELLOW;
extern const color_t COLOR_BLUE;
extern const color_t COLOR_WHITE;
extern const color_t COLOR_PINK;
extern const color_t COLOR_NAVY;
extern const color_t COLOR_RED;
extern const color_t COLOR_GREEN;
extern const color_t COLOR_DGREEN;
extern const color_t COLOR_BLACK;
extern const color_t COLOR_BACKGROUND;
extern const color_t COLOR_RED;
extern const color_t COLOR_GREEN;
extern const color_t COLOR_BROWN;
extern const color_t COLOR_WATER;
extern const color_t COLOR_OCEAN;
extern const color_t COLOR_1;
extern const color_t COLOR_2;
extern const color_t COLOR_3;
extern const color_t COLOR_4;
extern const color_t COLOR_5;
extern const color_t COLOR_6;
extern const color_t COLOR_8;
extern const color_t COLOR_9;
extern const color_t COLOR_10;
extern const color_t COLOR_11;
extern const color_t COLOR_12;
extern const color_t COLOR_13;
#endif