-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGame.h
67 lines (50 loc) · 1.26 KB
/
Game.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 GAME_H
#define GAME_H
#include <SFML/Graphics.hpp>
#include <string>
using namespace std;
#define DISP_WIDTH 320
#define DISP_FULL_HEIGHT 400
class Game
{
private:
int side;
char** board;
int *moves;
sf::RenderWindow *window;
Game();
Game(int side);
protected:
public:
static Game *myGame;
~Game();
void operator=(const Game &) = delete;
Game(Game &other) = delete;
int first, second;
char firstMove, secondMove;
// Getters and Setters
void setSide(int side);
int getSide();
void setWindow(sf::RenderWindow *window);
sf::RenderWindow *getWindow();
// Functions
void showBoard();
void showInstruction();
bool rowCrossed();
bool columnCrossed();
bool diagonalCrossed();
int checkWin(int move, int turn);
int newMove(int turn, int move, int x, int y);
void setRenderWindow(sf::RenderWindow *window);
void renderGameField();
void drawTick(int x, int y);
void drawRound(int x, int y);
void drawInfo(int state);
void clearText();
void drawWinnerText(string winner);
// static functions
static void checkDisplayClosed(sf::RenderWindow *window);
static Game *GetInstance();
static Game *GetInstance(int side);
};
#endif // GAME_H