-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgame.h
90 lines (78 loc) · 2.25 KB
/
game.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
/*******************************************************************
** Taken and adapted from learnopengl.com (part of a Breakout game)
******************************************************************/
#ifndef GAME_H
#define GAME_H
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
#include "Camera.h"
#include "game_level.h"
#include "game_object.h"
#include "state_manager.h"
// Represents the current state of the game
enum GameState {
GAME_MENU,
GAME_2D,
GAME_3D
};
enum Target {
NOP,
CAM_JUMP,
CAM_SLIDE,
MODEL_JUMP
};
// Structure used for move using a Bezier's curve
struct Bezier {
glm::vec3 depart;
glm::vec3 middle;
glm::vec3 arrivee;
GLfloat time_elapsed;
Target target;
};
// Game holds all game-related state and functionality.
// Combines all game-related data into a single class for
// easy access to each of the components and manageability.
class Game
{
public:
// Game state
GameState State;
GLboolean Keys[1024];
GLboolean ProcessedKeys[1024];
GLuint Width, Height;
StateManager State_manager;
// Constructor/Destructor
Game();
~Game();
// Initialize game state (load all shaders/textures/levels)
void Init();
// GameLoop
void ProcessInput(GLfloat dt);
void ProcessMouseMovement(GLdouble xpos, GLdouble ypos);
void ProcessMouseScroll(GLdouble yoffset);
void ProcessEndingMusic();
void Update(GLfloat dt);
void Render();
static glm::vec3 Update_Bezier(glm::vec3 depart,glm::vec3 middle,glm::vec3 arrivee,float t);
private:
Camera Cam;
GLfloat lastX, lastY;
GLboolean firstMouse;
std::vector<GameLevel> Levels;
GLuint Level;
std::vector<GameModel> Models;
std::vector<Object2D> Sprites;
Bezier bezier;
GLboolean Selected_sprite;
std::string Music;
GLfloat DinoSpin;
GLboolean Change_level, Turbo;
void GoMENU();
void Go2D();
void Go3D();
void SetBezier(GLint x, GLint y);
void SetBezier(glm::vec3 new_cam_pos);
void ChangeVolume(GLfloat prev, GLfloat next);
};
#endif