From 29e6fb2e2a2c0f02098b482107d62c3169a82952 Mon Sep 17 00:00:00 2001 From: Stephen Hall Date: Fri, 27 Dec 2013 19:18:59 -0500 Subject: [PATCH 1/6] Moved json files into chesspp folder. Removed automatic prefix of "chesspp" in graphics config. --- config/{ => chesspp}/board.json | 0 config/{ => chesspp}/graphics.json | 0 src/config/BoardConfig.hpp | 4 ++-- src/config/GraphicsConfig.hpp | 6 +++--- src/gfx/Graphics.cpp | 10 +++++----- 5 files changed, 10 insertions(+), 10 deletions(-) rename config/{ => chesspp}/board.json (100%) rename config/{ => chesspp}/graphics.json (100%) diff --git a/config/board.json b/config/chesspp/board.json similarity index 100% rename from config/board.json rename to config/chesspp/board.json diff --git a/config/graphics.json b/config/chesspp/graphics.json similarity index 100% rename from config/graphics.json rename to config/chesspp/graphics.json diff --git a/src/config/BoardConfig.hpp b/src/config/BoardConfig.hpp index 7169d64..ac93102 100644 --- a/src/config/BoardConfig.hpp +++ b/src/config/BoardConfig.hpp @@ -32,7 +32,7 @@ namespace chesspp public: BoardConfig(GraphicsConfig const &gfx) - : Configuration("config/board.json") + : Configuration("config/chesspp/board.json") , board_width (reader()["chesspp"]["board"]["width"] ) , board_height (reader()["chesspp"]["board"]["height"] ) , cell_width (reader()["chesspp"]["board"]["cell width"] ) @@ -53,7 +53,7 @@ namespace chesspp } } - auto const &tex = gfx.spritePaths("board", "pieces"); + auto const &tex = gfx.spritePaths("chesspp", "board", "pieces"); for(auto const &suit : tex) { for(auto const &piece : suit.second.object()) diff --git a/src/config/GraphicsConfig.hpp b/src/config/GraphicsConfig.hpp index e7ac4d4..0775efd 100644 --- a/src/config/GraphicsConfig.hpp +++ b/src/config/GraphicsConfig.hpp @@ -11,7 +11,7 @@ namespace chesspp { public: GraphicsConfig() - : Configuration("config/graphics.json") + : Configuration("config/chesspp/graphics.json") { } virtual ~GraphicsConfig() = default; @@ -23,7 +23,7 @@ namespace chesspp template std::string spritePath(Args const &... path) const { - auto val = reader.navigate("chesspp", path...); + auto val = reader.navigate(path...); if(val.type() != json_string) { return normalize(reader()["chesspp"]["missing"]); @@ -34,7 +34,7 @@ namespace chesspp template auto spritePaths(Args const &... path) const -> std::map { - return reader.navigate("chesspp", path...).object(); + return reader.navigate(path...).object(); } }; } diff --git a/src/gfx/Graphics.cpp b/src/gfx/Graphics.cpp index c6039e7..9da5a05 100644 --- a/src/gfx/Graphics.cpp +++ b/src/gfx/Graphics.cpp @@ -13,11 +13,11 @@ namespace chesspp : display(disp) , gfx_config(gfxc) , board_config(bc) - , board (TextureManager::instance().load(gfx_config.spritePath("board", "board" ))) - , valid_move (TextureManager::instance().load(gfx_config.spritePath("board", "valid move" ))) - , enemy_move (TextureManager::instance().load(gfx_config.spritePath("board", "enemy move" ))) - , valid_capture(TextureManager::instance().load(gfx_config.spritePath("board", "valid capture"))) - , enemy_capture(TextureManager::instance().load(gfx_config.spritePath("board", "enemy capture"))) + , board (TextureManager::instance().load(gfx_config.spritePath("chesspp", "board", "board" ))) + , valid_move (TextureManager::instance().load(gfx_config.spritePath("chesspp", "board", "valid move" ))) + , enemy_move (TextureManager::instance().load(gfx_config.spritePath("chesspp", "board", "enemy move" ))) + , valid_capture(TextureManager::instance().load(gfx_config.spritePath("chesspp", "board", "valid capture"))) + , enemy_capture(TextureManager::instance().load(gfx_config.spritePath("chesspp", "board", "enemy capture"))) { } From b5bc9c5408c56776ca9f5c68d2ba70a1c4b910ce Mon Sep 17 00:00:00 2001 From: Stephen Hall Date: Fri, 27 Dec 2013 19:23:38 -0500 Subject: [PATCH 2/6] Removed "chesspp" node from graphics.json and fixed all code broken by that change. --- config/chesspp/graphics.json | 59 +++++++++++++++++------------------- src/config/BoardConfig.hpp | 2 +- src/gfx/Graphics.cpp | 10 +++--- 3 files changed, 34 insertions(+), 37 deletions(-) diff --git a/config/chesspp/graphics.json b/config/chesspp/graphics.json index b7a723d..b60e12a 100644 --- a/config/chesspp/graphics.json +++ b/config/chesspp/graphics.json @@ -1,38 +1,35 @@ { - "chesspp": + "missing": "res/img/missing.png", + "board": { - "missing": "res/img/missing.png", - "board": + "board": "res/img/chessboard_640x640.png", + "valid move": "res/img/valid_move.png", + "enemy move": "res/img/enemy_move.png", + "valid capture": "res/img/valid_capture.png", + "enemy capture": "res/img/enemy_capture.png", + "pieces": { - "board": "res/img/chessboard_640x640.png", - "valid move": "res/img/valid_move.png", - "enemy move": "res/img/enemy_move.png", - "valid capture": "res/img/valid_capture.png", - "enemy capture": "res/img/enemy_capture.png", - "pieces": + "Black": { - "Black": - { - "Pawn": "res/img/pieces/black/pawn.png", - "Rook": "res/img/pieces/black/rook.png", - "Knight": "res/img/pieces/black/knight.png", - "Bishop": "res/img/pieces/black/bishop.png", - "Queen": "res/img/pieces/black/queen.png", - "King": "res/img/pieces/black/king.png", - "": "res/img/missing.png" - }, - "White": - { - "Pawn": "res/img/pieces/white/pawn.png", - "Rook": "res/img/pieces/white/rook.png", - "Knight": "res/img/pieces/white/knight.png", - "Bishop": "res/img/pieces/white/bishop.png", - "Queen": "res/img/pieces/white/queen.png", - "King": "res/img/pieces/white/king.png", - "": "res/img/missing.png" - }, - "": "res/img/missing.png" - } + "Pawn": "res/img/pieces/black/pawn.png", + "Rook": "res/img/pieces/black/rook.png", + "Knight": "res/img/pieces/black/knight.png", + "Bishop": "res/img/pieces/black/bishop.png", + "Queen": "res/img/pieces/black/queen.png", + "King": "res/img/pieces/black/king.png", + "": "res/img/missing.png" + }, + "White": + { + "Pawn": "res/img/pieces/white/pawn.png", + "Rook": "res/img/pieces/white/rook.png", + "Knight": "res/img/pieces/white/knight.png", + "Bishop": "res/img/pieces/white/bishop.png", + "Queen": "res/img/pieces/white/queen.png", + "King": "res/img/pieces/white/king.png", + "": "res/img/missing.png" + }, + "": "res/img/missing.png" } } } diff --git a/src/config/BoardConfig.hpp b/src/config/BoardConfig.hpp index ac93102..67e4aee 100644 --- a/src/config/BoardConfig.hpp +++ b/src/config/BoardConfig.hpp @@ -53,7 +53,7 @@ namespace chesspp } } - auto const &tex = gfx.spritePaths("chesspp", "board", "pieces"); + auto const &tex = gfx.spritePaths("board", "pieces"); for(auto const &suit : tex) { for(auto const &piece : suit.second.object()) diff --git a/src/gfx/Graphics.cpp b/src/gfx/Graphics.cpp index 9da5a05..c6039e7 100644 --- a/src/gfx/Graphics.cpp +++ b/src/gfx/Graphics.cpp @@ -13,11 +13,11 @@ namespace chesspp : display(disp) , gfx_config(gfxc) , board_config(bc) - , board (TextureManager::instance().load(gfx_config.spritePath("chesspp", "board", "board" ))) - , valid_move (TextureManager::instance().load(gfx_config.spritePath("chesspp", "board", "valid move" ))) - , enemy_move (TextureManager::instance().load(gfx_config.spritePath("chesspp", "board", "enemy move" ))) - , valid_capture(TextureManager::instance().load(gfx_config.spritePath("chesspp", "board", "valid capture"))) - , enemy_capture(TextureManager::instance().load(gfx_config.spritePath("chesspp", "board", "enemy capture"))) + , board (TextureManager::instance().load(gfx_config.spritePath("board", "board" ))) + , valid_move (TextureManager::instance().load(gfx_config.spritePath("board", "valid move" ))) + , enemy_move (TextureManager::instance().load(gfx_config.spritePath("board", "enemy move" ))) + , valid_capture(TextureManager::instance().load(gfx_config.spritePath("board", "valid capture"))) + , enemy_capture(TextureManager::instance().load(gfx_config.spritePath("board", "enemy capture"))) { } From d010c5a329e36a3384c4e013ad1863b496512344 Mon Sep 17 00:00:00 2001 From: Stephen Hall Date: Fri, 27 Dec 2013 19:27:36 -0500 Subject: [PATCH 3/6] Removed "chesspp" node in board.json and fixed all code broken by that change. --- config/chesspp/board.json | 71 ++++++++++++++++++-------------------- src/config/BoardConfig.hpp | 14 ++++---- 2 files changed, 41 insertions(+), 44 deletions(-) diff --git a/config/chesspp/board.json b/config/chesspp/board.json index 0aa8b3a..6be1074 100644 --- a/config/chesspp/board.json +++ b/config/chesspp/board.json @@ -1,49 +1,46 @@ { - "chesspp": + "board": { - "board": + "width": 8, + "height": 8, + "pieces": + [ + ["Rook", "Knight", "Bishop", "Queen", "King", "Bishop", "Knight", "Rook"], + ["Pawn", "Pawn" , "Pawn" , "Pawn" , "Pawn", "Pawn" , "Pawn" , "Pawn"], + [null , null , null , null , null , null , null , null ], + [null , null , null , null , null , null , null , null ], + [null , null , null , null , null , null , null , null ], + [null , null , null , null , null , null , null , null ], + ["Pawn", "Pawn" , "Pawn" , "Pawn" , "Pawn", "Pawn" , "Pawn" , "Pawn"], + ["Rook", "Knight", "Bishop", "Queen", "King", "Bishop", "Knight", "Rook"] + ], + "suits": + [ + ["Black", "Black", "Black", "Black", "Black", "Black", "Black", "Black"], + ["Black", "Black", "Black", "Black", "Black", "Black", "Black", "Black"], + [null , null , null , null , null , null , null , null ], + [null , null , null , null , null , null , null , null ], + [null , null , null , null , null , null , null , null ], + [null , null , null , null , null , null , null , null ], + ["White", "White", "White", "White", "White", "White", "White", "White"], + ["White", "White", "White", "White", "White", "White", "White", "White"] + ], + "cell width": 80, + "cell height": 80, + "metadata": { - "width": 8, - "height": 8, - "pieces": + "pawn facing": [ - ["Rook", "Knight", "Bishop", "Queen", "King", "Bishop", "Knight", "Rook"], - ["Pawn", "Pawn" , "Pawn" , "Pawn" , "Pawn", "Pawn" , "Pawn" , "Pawn"], - [null , null , null , null , null , null , null , null ], - [null , null , null , null , null , null , null , null ], - [null , null , null , null , null , null , null , null ], - [null , null , null , null , null , null , null , null ], - ["Pawn", "Pawn" , "Pawn" , "Pawn" , "Pawn", "Pawn" , "Pawn" , "Pawn"], - ["Rook", "Knight", "Bishop", "Queen", "King", "Bishop", "Knight", "Rook"] - ], - "suits": - [ - ["Black", "Black", "Black", "Black", "Black", "Black", "Black", "Black"], - ["Black", "Black", "Black", "Black", "Black", "Black", "Black", "Black"], + [null , null , null , null , null , null , null , null ], + ["South", "South", "South", "South", "South", "South", "South", "South"], [null , null , null , null , null , null , null , null ], [null , null , null , null , null , null , null , null ], [null , null , null , null , null , null , null , null ], [null , null , null , null , null , null , null , null ], - ["White", "White", "White", "White", "White", "White", "White", "White"], - ["White", "White", "White", "White", "White", "White", "White", "White"] + ["North", "North", "North", "North", "North", "North", "North", "North"], + [null , null , null , null , null , null , null , null ] ], - "cell width": 80, - "cell height": 80, - "metadata": - { - "pawn facing": - [ - [null , null , null , null , null , null , null , null ], - ["South", "South", "South", "South", "South", "South", "South", "South"], - [null , null , null , null , null , null , null , null ], - [null , null , null , null , null , null , null , null ], - [null , null , null , null , null , null , null , null ], - [null , null , null , null , null , null , null , null ], - ["North", "North", "North", "North", "North", "North", "North", "North"], - [null , null , null , null , null , null , null , null ] - ], - "first turn": "White" - } + "first turn": "White" } } } diff --git a/src/config/BoardConfig.hpp b/src/config/BoardConfig.hpp index 67e4aee..cf65d73 100644 --- a/src/config/BoardConfig.hpp +++ b/src/config/BoardConfig.hpp @@ -33,13 +33,13 @@ namespace chesspp public: BoardConfig(GraphicsConfig const &gfx) : Configuration("config/chesspp/board.json") - , board_width (reader()["chesspp"]["board"]["width"] ) - , board_height (reader()["chesspp"]["board"]["height"] ) - , cell_width (reader()["chesspp"]["board"]["cell width"] ) - , cell_height (reader()["chesspp"]["board"]["cell height"]) + , board_width (reader()["board"]["width"] ) + , board_height (reader()["board"]["height"] ) + , cell_width (reader()["board"]["cell width"] ) + , cell_height (reader()["board"]["cell height"]) { - auto pieces = reader()["chesspp"]["board"]["pieces"]; - auto suits = reader()["chesspp"]["board"]["suits"]; + auto pieces = reader()["board"]["pieces"]; + auto suits = reader()["board"]["suits"]; for(BoardSize_t r = 0; r < board_height; ++r) { for(BoardSize_t c = 0; c < board_width; ++c) @@ -74,7 +74,7 @@ namespace chesspp template util::JsonReader::NestedValue metadata(Args const &... path) const { - return reader.navigate("chesspp", "board", "metadata", path...); + return reader.navigate("board", "metadata", path...); } }; } From 0c1bf72a6013ad8fd0d64ee656753ed0cdf50268 Mon Sep 17 00:00:00 2001 From: Stephen Hall Date: Fri, 27 Dec 2013 19:31:53 -0500 Subject: [PATCH 4/6] Renamed GraphicsConfig.hpp to ResourceConfig.hpp and fixed includes in dependent files. --- src/ChessPlusPlusState.hpp | 2 +- src/config/BoardConfig.hpp | 2 +- src/config/{GraphicsConfig.hpp => ResourceConfig.hpp} | 0 src/gfx/Graphics.hpp | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename src/config/{GraphicsConfig.hpp => ResourceConfig.hpp} (100%) diff --git a/src/ChessPlusPlusState.hpp b/src/ChessPlusPlusState.hpp index 5431e30..682e363 100644 --- a/src/ChessPlusPlusState.hpp +++ b/src/ChessPlusPlusState.hpp @@ -5,7 +5,7 @@ #include "TextureManager.hpp" #include "gfx/Graphics.hpp" #include "config/Configuration.hpp" -#include "config/GraphicsConfig.hpp" +#include "config/ResourceConfig.hpp" #include "board/Board.hpp" #include "factory/ClassicFactory.hpp" diff --git a/src/config/BoardConfig.hpp b/src/config/BoardConfig.hpp index cf65d73..060a474 100644 --- a/src/config/BoardConfig.hpp +++ b/src/config/BoardConfig.hpp @@ -2,7 +2,7 @@ #define ChessPlusPlusBoardConfigurationManagerClass_HeaderPlusPlus #include "Configuration.hpp" -#include "GraphicsConfig.hpp" +#include "ResourceConfig.hpp" #include "util/Position.hpp" #include diff --git a/src/config/GraphicsConfig.hpp b/src/config/ResourceConfig.hpp similarity index 100% rename from src/config/GraphicsConfig.hpp rename to src/config/ResourceConfig.hpp diff --git a/src/gfx/Graphics.hpp b/src/gfx/Graphics.hpp index e039a8f..d7633b5 100644 --- a/src/gfx/Graphics.hpp +++ b/src/gfx/Graphics.hpp @@ -2,7 +2,7 @@ #define GraphicsHandlerClass_HeaderPlusPlus #include "SFML.hpp" -#include "config/GraphicsConfig.hpp" +#include "config/ResourceConfig.hpp" #include "config/BoardConfig.hpp" #include "board/Board.hpp" From 09650aed551463c7fa3cb7857b4a7ab5307ab359 Mon Sep 17 00:00:00 2001 From: Stephen Hall Date: Fri, 27 Dec 2013 19:38:07 -0500 Subject: [PATCH 5/6] Renamed class GraphicsConfig to ResourceConfig Fixed all other dependent code. --- config/chesspp/{graphics.json => resources.json} | 0 src/ChessPlusPlusState.cpp | 4 ++-- src/ChessPlusPlusState.hpp | 2 +- src/config/BoardConfig.hpp | 6 +++--- src/config/ResourceConfig.hpp | 14 +++++++------- src/gfx/Graphics.cpp | 14 +++++++------- src/gfx/Graphics.hpp | 4 ++-- 7 files changed, 22 insertions(+), 22 deletions(-) rename config/chesspp/{graphics.json => resources.json} (100%) diff --git a/config/chesspp/graphics.json b/config/chesspp/resources.json similarity index 100% rename from config/chesspp/graphics.json rename to config/chesspp/resources.json diff --git a/src/ChessPlusPlusState.cpp b/src/ChessPlusPlusState.cpp index b678099..255cf60 100644 --- a/src/ChessPlusPlusState.cpp +++ b/src/ChessPlusPlusState.cpp @@ -10,9 +10,9 @@ namespace chesspp ChessPlusPlusState::ChessPlusPlusState(Application &_app, sf::RenderWindow &disp) : AppState(disp) , app(_app) - , board_config(gfx_config) + , board_config(rc_config) , classic_factory(board_config) - , graphics(display, gfx_config, board_config) + , graphics(display, rc_config, board_config) , board(board_config, classic_factory.factory()) , p(-1, -1) , players(util::KeyIter diff --git a/src/ChessPlusPlusState.hpp b/src/ChessPlusPlusState.hpp index 682e363..a5ab6b7 100644 --- a/src/ChessPlusPlusState.hpp +++ b/src/ChessPlusPlusState.hpp @@ -19,7 +19,7 @@ namespace chesspp class ChessPlusPlusState : public AppState { Application &app; - config::GraphicsConfig gfx_config; + config::ResourceConfig rc_config; config::BoardConfig board_config; factory::ClassicFactory classic_factory; gfx::GraphicsHandler graphics; diff --git a/src/config/BoardConfig.hpp b/src/config/BoardConfig.hpp index 060a474..376db91 100644 --- a/src/config/BoardConfig.hpp +++ b/src/config/BoardConfig.hpp @@ -31,7 +31,7 @@ namespace chesspp Textures_t textures; public: - BoardConfig(GraphicsConfig const &gfx) + BoardConfig(ResourceConfig const &rcc) : Configuration("config/chesspp/board.json") , board_width (reader()["board"]["width"] ) , board_height (reader()["board"]["height"] ) @@ -53,12 +53,12 @@ namespace chesspp } } - auto const &tex = gfx.spritePaths("board", "pieces"); + auto const &tex = rcc.spritePaths("board", "pieces"); for(auto const &suit : tex) { for(auto const &piece : suit.second.object()) { - textures[suit.first][piece.first] = gfx.normalize(Textures_t::mapped_type::mapped_type(piece.second)); + textures[suit.first][piece.first] = rcc.normalize(Textures_t::mapped_type::mapped_type(piece.second)); } } } diff --git a/src/config/ResourceConfig.hpp b/src/config/ResourceConfig.hpp index 0775efd..2508b69 100644 --- a/src/config/ResourceConfig.hpp +++ b/src/config/ResourceConfig.hpp @@ -1,5 +1,5 @@ -#ifndef ChessPlusPlusGraphicsConfigurationManagerClass_HeaderPlusPlus -#define ChessPlusPlusGraphicsConfigurationManagerClass_HeaderPlusPlus +#ifndef ChessPlusPlusResourceConfigurationManagerClass_HeaderPlusPlus +#define ChessPlusPlusResourceConfigurationManagerClass_HeaderPlusPlus #include "Configuration.hpp" @@ -7,14 +7,14 @@ namespace chesspp { namespace config { - class GraphicsConfig : public Configuration + class ResourceConfig : public Configuration { public: - GraphicsConfig() - : Configuration("config/chesspp/graphics.json") + ResourceConfig() + : Configuration("config/chesspp/resources.json") { } - virtual ~GraphicsConfig() = default; + virtual ~ResourceConfig() = default; std::string normalize(std::string const &path) const { @@ -26,7 +26,7 @@ namespace chesspp auto val = reader.navigate(path...); if(val.type() != json_string) { - return normalize(reader()["chesspp"]["missing"]); + return normalize(reader()["missing"]); } return normalize(val); } diff --git a/src/gfx/Graphics.cpp b/src/gfx/Graphics.cpp index c6039e7..002af11 100644 --- a/src/gfx/Graphics.cpp +++ b/src/gfx/Graphics.cpp @@ -9,15 +9,15 @@ namespace chesspp { namespace gfx { - GraphicsHandler::GraphicsHandler(sf::RenderWindow &disp, config::GraphicsConfig &gfxc, config::BoardConfig &bc) + GraphicsHandler::GraphicsHandler(sf::RenderWindow &disp, config::ResourceConfig &rcc, config::BoardConfig &bc) : display(disp) - , gfx_config(gfxc) + , rc_config(rcc) , board_config(bc) - , board (TextureManager::instance().load(gfx_config.spritePath("board", "board" ))) - , valid_move (TextureManager::instance().load(gfx_config.spritePath("board", "valid move" ))) - , enemy_move (TextureManager::instance().load(gfx_config.spritePath("board", "enemy move" ))) - , valid_capture(TextureManager::instance().load(gfx_config.spritePath("board", "valid capture"))) - , enemy_capture(TextureManager::instance().load(gfx_config.spritePath("board", "enemy capture"))) + , board (TextureManager::instance().load(rc_config.spritePath("board", "board" ))) + , valid_move (TextureManager::instance().load(rc_config.spritePath("board", "valid move" ))) + , enemy_move (TextureManager::instance().load(rc_config.spritePath("board", "enemy move" ))) + , valid_capture(TextureManager::instance().load(rc_config.spritePath("board", "valid capture"))) + , enemy_capture(TextureManager::instance().load(rc_config.spritePath("board", "enemy capture"))) { } diff --git a/src/gfx/Graphics.hpp b/src/gfx/Graphics.hpp index d7633b5..c68e1eb 100644 --- a/src/gfx/Graphics.hpp +++ b/src/gfx/Graphics.hpp @@ -15,7 +15,7 @@ namespace chesspp class GraphicsHandler { sf::RenderWindow &display; - config::GraphicsConfig &gfx_config; + config::ResourceConfig &rc_config; config::BoardConfig &board_config; sf::Sprite board @@ -25,7 +25,7 @@ namespace chesspp , enemy_capture; public: - GraphicsHandler(sf::RenderWindow &display, config::GraphicsConfig &gfxc, config::BoardConfig &bc); + GraphicsHandler(sf::RenderWindow &display, config::ResourceConfig &rcc, config::BoardConfig &bc); //Draws the board background. void drawBackground(); From f191f41d0e59710cd7749de524588d9fbca44e24 Mon Sep 17 00:00:00 2001 From: Stephen Hall Date: Fri, 27 Dec 2013 19:42:16 -0500 Subject: [PATCH 6/6] Renamed ResourceConfig member functions spritePath and spritePaths to filePath(s) and repaired broken code due to the change. --- src/config/BoardConfig.hpp | 2 +- src/config/ResourceConfig.hpp | 4 ++-- src/gfx/Graphics.cpp | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/config/BoardConfig.hpp b/src/config/BoardConfig.hpp index 376db91..7dccaae 100644 --- a/src/config/BoardConfig.hpp +++ b/src/config/BoardConfig.hpp @@ -53,7 +53,7 @@ namespace chesspp } } - auto const &tex = rcc.spritePaths("board", "pieces"); + auto const &tex = rcc.filePaths("board", "pieces"); for(auto const &suit : tex) { for(auto const &piece : suit.second.object()) diff --git a/src/config/ResourceConfig.hpp b/src/config/ResourceConfig.hpp index 2508b69..af4c9e8 100644 --- a/src/config/ResourceConfig.hpp +++ b/src/config/ResourceConfig.hpp @@ -21,7 +21,7 @@ namespace chesspp return res_path + path; } template - std::string spritePath(Args const &... path) const + std::string filePath(Args const &... path) const { auto val = reader.navigate(path...); if(val.type() != json_string) @@ -32,7 +32,7 @@ namespace chesspp } //Must normalize return value template - auto spritePaths(Args const &... path) const -> std::map + auto filePaths(Args const &... path) const -> std::map { return reader.navigate(path...).object(); } diff --git a/src/gfx/Graphics.cpp b/src/gfx/Graphics.cpp index 002af11..f503e33 100644 --- a/src/gfx/Graphics.cpp +++ b/src/gfx/Graphics.cpp @@ -13,11 +13,11 @@ namespace chesspp : display(disp) , rc_config(rcc) , board_config(bc) - , board (TextureManager::instance().load(rc_config.spritePath("board", "board" ))) - , valid_move (TextureManager::instance().load(rc_config.spritePath("board", "valid move" ))) - , enemy_move (TextureManager::instance().load(rc_config.spritePath("board", "enemy move" ))) - , valid_capture(TextureManager::instance().load(rc_config.spritePath("board", "valid capture"))) - , enemy_capture(TextureManager::instance().load(rc_config.spritePath("board", "enemy capture"))) + , board (TextureManager::instance().load(rc_config.filePath("board", "board" ))) + , valid_move (TextureManager::instance().load(rc_config.filePath("board", "valid move" ))) + , enemy_move (TextureManager::instance().load(rc_config.filePath("board", "enemy move" ))) + , valid_capture(TextureManager::instance().load(rc_config.filePath("board", "valid capture"))) + , enemy_capture(TextureManager::instance().load(rc_config.filePath("board", "enemy capture"))) { }