-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboard.h
48 lines (37 loc) · 978 Bytes
/
board.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
#ifndef BOARD_H
#define BOARD_H
#include <QHBoxLayout>
#include <QVBoxLayout>
#include "cell.h"
#include "figure.h"
#include <QObject>
#include <vector>
class Board : public QObject
{
Q_OBJECT
protected:
unsigned int h, w;
unsigned int figuresCount;
std::vector<Cell*> cells;
QVBoxLayout *layout;
QHBoxLayout **columnLayouts;
Figure *_selectedFigure;
std::vector<Figure*> figures;
void moveFigure(Figure *figure, Cell *cell);
std::vector<turn> turns;
bool isWhiteTurn;
void startTurn(bool isWhiteTurn);
public slots:
void figureSelecting(Figure *figure);
void tryMakeTurn(Cell *cell);
public:
Figure* findFigureOnCell(Cell *cell);
Board(QWidget *parent = nullptr, unsigned int h = 10, unsigned int w = 10, unsigned int countOfFigures = 20);
void Show();
~Board();
QLayout* getBoard();
signals:
void messageCreated(QString message);
void turnComplete(turn info);
};
#endif // BOARD_H