-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGame.h
More file actions
44 lines (32 loc) · 703 Bytes
/
Game.h
File metadata and controls
44 lines (32 loc) · 703 Bytes
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
#pragma once
#include <QObject>
#include <mutex>
#include <atomic>
#include "Field.h"
class Game : public QObject {
Q_OBJECT
public:
Game();
~Game() = default;
bool checkGameEnd();
void gameLoop();
Field& field();
const Field& field() const;
const Player* currentPlayersTurn() const;
uint turnNumber() const;
public slots:
void finishGame();
signals:
void fieldUpdated();
void nextPlayerTurn();
void nextTurn();
void gameFinished();
private:
Field m_field;
Player *m_currentPlayer;
mutable std::mutex m_currentPlayerMutex;
std::atomic_bool m_finishGame;
volatile bool m_gameFinished;
uint m_turn;
protected:
};