-
Notifications
You must be signed in to change notification settings - Fork 0
/
Game.hpp
60 lines (47 loc) · 1.28 KB
/
Game.hpp
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
// MIT License
//
// Copyright (c) 2024 Tomáš Mark
//
#ifndef __GAME_H__
#define __GAME_H__
#include "CppEnetWrapper.hpp"
#include "Field.hpp"
#include "Player.hpp"
#include "Snake.hpp"
#include "Fruit.hpp"
#include "Graphic.hpp"
#include "Keyboard.hpp"
#include <chrono>
#include <string>
#include <vector>
#include <map>
static const int SCORE_MULTIPLIER = 11;
static const int SNAKE_SPEED = 1;
class Game
{
int totalPlayers;
int totalDeadPlayers;
std::shared_ptr<Field> field;
std::unique_ptr<Fruit> fruit;
std::unique_ptr<Graphic> graphic; // Graphic* Graphic
std::unique_ptr<std::unique_ptr<Player>[]> players;
std::unique_ptr<std::shared_ptr<Snake>[]> snakes;
CppEnetWrapper::MyEnetNetwork &net;
bool isMultiplayerActive;
bool isRemoteSnakeSync = false;
bool isSomeoneDisconnected = false;
public:
Game(int width,
int height,
double fruitEmptiness,
int totalPlayers,
std::string *playerNames,
CppEnetWrapper::MyEnetNetwork &net,
bool isMultiplayerActive);
~Game();
void mainLoop();
void checkSnakeConflicts(int currSnake);
bool isGameGoingOn;
bool getIsGameGoingOn() const;
};
#endif // __GAME_H__