-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpacman.h
77 lines (67 loc) · 1.64 KB
/
pacman.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
#ifndef PACMAN_H
#define PACMAN_H
#include "characters.h"
#include <ConsoleWindow.h>
#include <QElapsedTimer>
#include <memory>
/**
* @todo write docs
*/
enum move_direction;
enum state_of_game {
gameOver, theGameIsOn, gameWon,
};
enum on_screen { menu, game, smallMenu};
class PacmanWindow : public ConsoleWindow
{
int cycle;
int currentCycle;
bool pillIsActive;
bool pillIsOnPoint;
bool pillHasSpawned;
QElapsedTimer pillTimer;
QElapsedTimer pillSpawnTimer;
Pacman player;
std::vector<coordinates> ghosts_original_pos;
std::vector<coordinates> possiblePillPositions;
std::vector<std::unique_ptr<Ghost>> ghosts;
state_of_game gameState;
on_screen currentScreen;
int levelMaxPoints;
std::vector<std::vector<char>> levelMap;
std::string levelFile;
int timeNeeded;
int bestTime;
std::vector<std::vector<char>> Parsemap(int &pointCount);
void Initialize();
void writeHeader();
void writeFooter();
void MainMenu();
void WinMenu();
void GameOverMenu();
void SmallMenu();
class Time{
QElapsedTimer timer;
int savedTime;
bool paused;
public:
int Elapsed();
void Pause();
void Start();
void UnPause();
};
Time clock;
void checkIfWin();
void ManagePills();
std::vector<move_direction> GetPossibleDirections(const Meeple* meeple);
void MoveGhosts();
void MovePacman();
void GhostCollisionEvent();
void Cleanup();
protected:
virtual void onRefresh() override;
virtual void onKeyPress() override;
public:
PacmanWindow();
};
#endif // PACMAN_H