Skip to content

Commit 73d5db8

Browse files
author
Thumperrr
committed
Integrated the fixed configuration classes.
1 parent bd1965d commit 73d5db8

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

src/AppStateGame.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace chesspp
55
AppStateGame::AppStateGame( Application* _app, sf::RenderWindow *_display ) : app(_app), AppState(_display), graphics(display)
66
{
77
board = new Board();
8-
board->newGame(configuration::instance().getBoardInitialLayout());
8+
board->newGame(boardConfig.getInitialLayout());
99
}
1010

1111
int AppStateGame::id() { return 1; }

src/AppStateGame.h

+2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ namespace chesspp
1818
{
1919
Application* app;
2020
Board* board;
21+
2122
graphics::GraphicsHandler graphics;
23+
configuration::BoardConfig boardConfig;
2224

2325
public:
2426
AppStateGame(Application* _app, sf::RenderWindow *_display);

src/Graphics.cpp

+9-6
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@ namespace chesspp
66
{
77

88

9-
GraphicsHandler::GraphicsHandler( sf::RenderWindow *_display )
10-
: display(_display),
11-
cell_size(configuration::instance().getCellWidth())
9+
GraphicsHandler::GraphicsHandler( sf::RenderWindow *_display ) : display(_display)
1210
{
1311
try
1412
{
15-
board = sf::Sprite(TextureManager::getInstance().Load(configuration::instance().getSpritePath_board()));
16-
pieces = sf::Sprite(TextureManager::getInstance().Load(configuration::instance().getSpritePath_pieces()));
17-
validMove = sf::Sprite(TextureManager::getInstance().Load(configuration::instance().getSpritePath_validMove()));
13+
configuration::BoardConfig boardConfig;
14+
configuration::GraphicsConfig graphicsConfig;
15+
16+
board = sf::Sprite(TextureManager::getInstance().Load(graphicsConfig.getSpritePath_board()));
17+
pieces = sf::Sprite(TextureManager::getInstance().Load(graphicsConfig.getSpritePath_pieces()));
18+
validMove = sf::Sprite(TextureManager::getInstance().Load(graphicsConfig.getSpritePath_validMove()));
19+
20+
cell_size = boardConfig.getCellWidth();
1821
}
1922
catch (chesspp::exception &e)
2023
{

src/Graphics.h

+3-6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ namespace chesspp
1818
{
1919
class GraphicsHandler
2020
{
21+
sf::Sprite board, pieces, validMove;
22+
uint16_t cell_size;
23+
sf::RenderWindow *display;
2124

2225
public:
2326
GraphicsHandler(sf::RenderWindow *_display);
@@ -39,12 +42,6 @@ namespace chesspp
3942

4043
//Draws the entire game.
4144
void drawBoard(const Board *b);
42-
43-
44-
private:
45-
sf::Sprite board, pieces, validMove;
46-
const int cell_size;
47-
sf::RenderWindow *display;
4845
};
4946
}
5047
}

0 commit comments

Comments
 (0)