From 9ccf3248f2d9cd2cb9bd5a4826e8d0409f98f3d1 Mon Sep 17 00:00:00 2001 From: Stephen Enders Date: Tue, 5 Jan 2021 00:30:53 -0500 Subject: Initial commit - Rendering --- helper.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 helper.h (limited to 'helper.h') diff --git a/helper.h b/helper.h new file mode 100644 index 0000000..dbebfb6 --- /dev/null +++ b/helper.h @@ -0,0 +1,55 @@ +#ifndef UR_HELPER_H +#define UR_HELPER_H + +#include +#include +#include + +// BOARD LAYOUT [0, 1, 2, 3](start) [4,5,6,7,8,9,10,11](middle), [12,13](end) + +static const unsigned int SPRITE_SIZE = 16; +static const unsigned int NUM_PIECES = 7; +static const unsigned int SAFE_SPACE = 7; // 0-indexed +static const unsigned int EXIT_SPACE = 14; // final space + 1 + +static const sf::Color GLOBAL_MASK(255, 0, 255, 255); + +struct piece_t +{ + int id; + int position; + std::shared_ptr sprite; +}; + + +struct player_t +{ + int score; + std::shared_ptr>> pieces; +}; + + +std::shared_ptr> +loadTextures(const char* path); + +sf::Font loadFont(); + +std::shared_ptr +createPlayer(sf::Texture pieceTexture); + +std::shared_ptr +createPiece(int id, sf::Texture texture); + +bool +clickedPiece(sf::Vector2i mousePosition, std::shared_ptr piece); + +bool +canMovePiece( + std::shared_ptr piece, + int roll, + std::shared_ptr>> myPieces, + std::shared_ptr>> enemyPieces); + +std::vector getLegalMoves(std::shared_ptr activePlayer, std::shared_ptr opponent); +#endif + -- cgit v1.2.3-54-g00ecf