-
Notifications
You must be signed in to change notification settings - Fork 0
/
board.cpp
35 lines (30 loc) · 1013 Bytes
/
board.cpp
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
#include "board.h"
#include "boardcontroller.h"
Board::Board(QWidget * parent)
: QuickWidget(parent)
, boardController_(new BoardController(this))
{
//qmlRegisterUncreatableType<BoardController>("Match3", 1, 0, "BoardController", "Only available for enum access");
setContextProperties({
{"_boardController", boardController_}
});
initQmlScene(QUrl("qrc:/qml/Board.qml"));
}
const Board::BoardItemPtr &Board::at(const Coordinate & coordinate) const
{
return boardItemMatrix_.at(coordinate.x()).at(coordinate.y());
}
Board::BoardItemPtr &Board::at(const Coordinate & coordinate)
{
return boardItemMatrix_.at(coordinate.x()).at(coordinate.y());
}
//void Board::move(const Coordinate & from, const Coordinate & to)
//{
//// auto currPiece = at(t_from);
//// if (currPiece) {
//// if (currPiece->isMovePermitted(t_from, t_to, *this)) {
//// at(t_to) = currPiece;
//// at(t_from).reset();
//// }
//// }
//}