-
Notifications
You must be signed in to change notification settings - Fork 2
/
GameManager.h
73 lines (47 loc) · 1.07 KB
/
GameManager.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
//
// Created by fredr on 31.03.2020.
//
#ifndef PACMAN_GAMEMANAGER_H
#define PACMAN_GAMEMANAGER_H
#include "Screen.h"
#include "Pacman.h"
#include "Map.h"
#include "Blinky.h"
#include "Clyde.h"
#include "Inky.h"
#include "Pinky.h"
#include "Npc.h"
#include <vector>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_timer.h>
class GameManager {
public:
static GameManager *getInstance();
static void deleteInstance();
void runGame();
void setHasCollided();
void handleEvents();
void update();
void render();
void clean();
enum Direction {
};
private:
int pacmanHp = 3;
static GameManager *instance;
bool isRunning;
bool hasCollided = false;
Uint32 frameStart;
int frameTime;
const int FPS = 60;
const int frameDelay = 1000 / FPS;
Direction direction;
Pacman *pacman = Pacman::getInstance();
std::vector<GameObject *> players;
std::vector<GameObject *> pills;
GameManager();
~GameManager();
void checkFrameRate();
};
#endif //PACMAN_GAMEMANAGER_H