-
Notifications
You must be signed in to change notification settings - Fork 0
/
gameboard.h
67 lines (59 loc) · 1.34 KB
/
gameboard.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
#ifndef GAMEBOARD_H
#define GAMEBOARD_H
#include <QWidget>
#include <QMessageBox>
#include <QHBoxLayout>
#include <QFileDialog>
#include <QDateTime>
#include "snake.h"
#include "map.h"
#include "scoreboard.h"
#include "aisnake.h"
#include "constants.h"
namespace Ui {
class GameBoard;
}
class GameBoard : public QWidget
{
Q_OBJECT
public:
explicit GameBoard(QWidget *parent = nullptr);
void init();
void initPlayers();
void loadGame(QString filename);
~GameBoard();
private:
Ui::GameBoard *ui;
int playerNum = 1;
int playersAlive;
bool withAi = false;
QVector<Snake*> players;
Map* map;
QVector<ScoreBoard*> scoreboards;
void switchPauseResume();
void pause();
void resume();
void addPlayer(Snake* player);
void initScoreboard(Snake* player);
void initFoodSelect();
void initControlPanel();
void gameOver(int surviverId);
protected:
void showEvent(QShowEvent *) override;
void keyPressEvent(QKeyEvent *event) override;
public slots:
void noWalls();
void surroundingWalls();
void singlePlayer();
void doublePlayers();
void triplePlayers();
void onlyAI();
void playerAndAI();
void snakeDied(int snakeId);
void saveGame();
void startEditing();
void finishEditing();
void editWalls();
void editFoods();
};
#endif // GAMEBOARD_H