-
Notifications
You must be signed in to change notification settings - Fork 0
/
Game.h
104 lines (73 loc) · 1.91 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#ifndef GAME_H
#define GAME_H
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include<stb_image.h>
#include "Shader.h"
#include "Camera.h"
#include "Model.h"
#include "Window.h"
#include "Bullet.h"
#include "Player.h"
#include "Enemy.h"
#include "SpriteRenderer.h"
#include "Animator.h"
#include "Settings.h"
#include "GameLevel.h"
#include "TextRenderer.h"
#include"Terrain.h"
#include <iostream>
#include <random>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <vector>
#include <tuple>
#include<map>
enum class GameState {
GAME_ACTIVE,
GAME_MENU,
GAME_INST,
GAME_WIN,
GAME_LOSE
};
const float toRadians = 3.14159265f / 180.0f;
class Game
{
public:
GameState state;
Settings settings;
GameLevel level;
Player player;
GameObject* floorObject;
Camera* camera;
Animator* zombieAnimator;
unsigned int score;
glm::mat4 perspectiveProjection , orthoProjection;
glm::vec3 cameraOffset;
//Animations
std::map<std::string , Animation> animations;
std::map<std::string, Animator> animators;
std::map<std::string, Shader> shaders;
std::map<std::string, Model> models;
std::map<std::string, GameObject> gameObjects;
std::map<std::string, Texture2D> textures;
Game();
void Init();
void InitGameObjects();
void configureLighting(Shader& shader, glm::vec3 spotPos);
void bulletHandler(vector<Bullet>& bullets, vector<Enemy>& objects, Shader shader, float deltaTime);
void playerCollisionCheck(Player player, vector<Enemy>& objects);
void playerCollisionCheck(Player& player, vector<GameObject>& objects, float deltaTime);
glm::vec3 spawnPosition(glm::vec3 playerPosition);
~Game();
private:
void InitShaders();
void InitTextures();
void InitAnimations();
void InitModels();
};
#endif