2021-06-10 12:42:51 +00:00
|
|
|
#pragma once
|
2020-11-27 13:10:09 +00:00
|
|
|
|
2020-11-28 13:10:25 +00:00
|
|
|
#include "Board.hpp"
|
2021-06-16 10:52:04 +00:00
|
|
|
#include "Canvas.hpp"
|
2021-06-24 11:32:52 +00:00
|
|
|
#include "Ghost.hpp"
|
2020-11-28 13:10:25 +00:00
|
|
|
#include "PacMan.hpp"
|
|
|
|
#include "Pellets.hpp"
|
2021-06-24 11:32:52 +00:00
|
|
|
#include "Score.hpp"
|
2020-11-28 13:10:25 +00:00
|
|
|
#include "SuperPellets.hpp"
|
|
|
|
|
2021-07-05 12:10:01 +00:00
|
|
|
namespace pacman {
|
|
|
|
|
2020-11-28 13:10:25 +00:00
|
|
|
class InputState;
|
2020-11-27 13:10:09 +00:00
|
|
|
|
|
|
|
class Game {
|
|
|
|
public:
|
|
|
|
Game();
|
|
|
|
void run();
|
|
|
|
|
|
|
|
private:
|
2021-06-24 11:32:52 +00:00
|
|
|
friend class Canvas;
|
|
|
|
|
2021-06-16 10:52:04 +00:00
|
|
|
Canvas canvas;
|
2020-11-27 13:10:09 +00:00
|
|
|
Board board;
|
2020-11-28 13:10:25 +00:00
|
|
|
PacMan pacMan;
|
|
|
|
Pellets pellets;
|
|
|
|
SuperPellets superPellets;
|
2021-06-28 08:37:52 +00:00
|
|
|
std::tuple<Blinky, Speedy, Inky, Clyde> ghosts;
|
2021-06-24 08:32:54 +00:00
|
|
|
Score score;
|
2021-07-01 08:02:53 +00:00
|
|
|
std::chrono::milliseconds timeSinceDeath{};
|
2020-11-27 13:10:09 +00:00
|
|
|
|
2021-06-24 11:32:52 +00:00
|
|
|
void step(std::chrono::milliseconds delta, InputState inputState);
|
2021-06-16 11:59:16 +00:00
|
|
|
void eatPellets();
|
2021-06-20 16:52:34 +00:00
|
|
|
void processEvents(InputState & inputState);
|
2021-06-28 10:42:21 +00:00
|
|
|
void checkCollision(Ghost & g);
|
2020-11-27 16:16:42 +00:00
|
|
|
|
|
|
|
[[nodiscard]] static auto now();
|
2020-11-27 13:10:09 +00:00
|
|
|
};
|
2021-07-05 12:10:01 +00:00
|
|
|
|
|
|
|
} // namespace pacman
|