-
Notifications
You must be signed in to change notification settings - Fork 0
/
Game.cpp
61 lines (41 loc) · 996 Bytes
/
Game.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
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
#include "Game.h"
#include "Window.h"
int Game::boardTopLeftX;
int Game::boardTopLeftY;
Game::~Game() {
delete(board);
}
void Game::togglePromotionOptions() {
board->togglePromotionOptions();
}
void Game::calculateBoardStates() {
board->calculateBoardStates();
}
void Game::render() {
board->render(board->getBoardState());
}
void Game::update() {
}
void Game::makeRandomMove() {
board->makeRandomMove(board->getBoardState());
}
void Game::handleMouseButtonDown(SDL_MouseButtonEvent& b) {
board->handleMouseButtonDown(b,board->getBoardState());
}
void Game::init() {
boardTopLeftX = boardTopLeftY = 0;
board = new Board();
board->init();
}
void Game::resize() {
board->resize();
boardTopLeftX = (Window::screenWidth - board->getWidth()) / 2;
boardTopLeftY = (Window::screenHeight - board->getHeight()) / 2;
}
void Game::reset() {
board->reset();
}
void Game::unmakeMove() {
board->unMakeMove(board->getBoardState());
board->nextTurn(board->getBoardState());
}