diff --git a/FichiersCreationRessource/Sprites/objetJeu.kra b/FichiersCreationRessource/Sprites/objetJeu.kra index ff22961..3b42e09 100644 Binary files a/FichiersCreationRessource/Sprites/objetJeu.kra and b/FichiersCreationRessource/Sprites/objetJeu.kra differ diff --git a/FichiersCreationRessource/Sprites/objetJeu.kra~ b/FichiersCreationRessource/Sprites/objetJeu.kra~ deleted file mode 100644 index 4e5d74a..0000000 Binary files a/FichiersCreationRessource/Sprites/objetJeu.kra~ and /dev/null differ diff --git a/Pontu/include/engine/TextureHandler.h b/Pontu/include/engine/TextureHandler.h index 149a954..230ca12 100644 --- a/Pontu/include/engine/TextureHandler.h +++ b/Pontu/include/engine/TextureHandler.h @@ -22,7 +22,10 @@ #define MACRO_FOR_ALL_TEXTURES(M) \ M(Island) \ M(Bridge) \ - M(Piece) \ + M(PieceRed) \ + M(PieceViolet) \ + M(PieceBlue) \ + M(PieceYellow) \ M(Water) /** diff --git a/Pontu/include/view/PiecesDrawer.h b/Pontu/include/view/PiecesDrawer.h index d4adc3f..3d56ab0 100644 --- a/Pontu/include/view/PiecesDrawer.h +++ b/Pontu/include/view/PiecesDrawer.h @@ -5,6 +5,6 @@ #include #include "model/Piece.h" -void drawPieces(SDL_Renderer* renderer, const SDL_Rect* boardRect, const Piece arrPieces[], const size_t nbPieces, SDL_Texture* piece); +void drawPiecesPlayer(SDL_Renderer* renderer, const SDL_Rect* boardRect, const Piece arrPieces[], const size_t nbPieces, const size_t numPlayer, SDL_Texture* piece); #endif //PIECES_DRAWER_INCLUDED \ No newline at end of file diff --git a/Pontu/rsrc/img/PieceBlue.png b/Pontu/rsrc/img/PieceBlue.png new file mode 100644 index 0000000..f2e262e Binary files /dev/null and b/Pontu/rsrc/img/PieceBlue.png differ diff --git a/Pontu/rsrc/img/PieceRed.png b/Pontu/rsrc/img/PieceRed.png new file mode 100644 index 0000000..d2abdbf Binary files /dev/null and b/Pontu/rsrc/img/PieceRed.png differ diff --git a/Pontu/rsrc/img/Piece.png b/Pontu/rsrc/img/PieceViolet.png similarity index 100% rename from Pontu/rsrc/img/Piece.png rename to Pontu/rsrc/img/PieceViolet.png diff --git a/Pontu/rsrc/img/PieceYellow.png b/Pontu/rsrc/img/PieceYellow.png new file mode 100644 index 0000000..d5ea051 Binary files /dev/null and b/Pontu/rsrc/img/PieceYellow.png differ diff --git a/Pontu/src/view/GameDrawer.c b/Pontu/src/view/GameDrawer.c index 351b03e..dbd2df4 100644 --- a/Pontu/src/view/GameDrawer.c +++ b/Pontu/src/view/GameDrawer.c @@ -17,7 +17,10 @@ bool drawGame(SDL_Renderer* renderer, const SDL_Rect* windowSize, const SDL_Rect drawBoard(renderer, boardRect, &(game->board), textureHandler->textures[TEXTURE_Island], textureHandler->textures[TEXTURE_Bridge], textureHandler->textures[TEXTURE_Water]); - drawPieces(renderer, boardRect, game->board.arrPieces, game->board.nbPieces, textureHandler->textures[TEXTURE_Piece]); + + + drawPiecesPlayer(renderer, boardRect, game->board.arrPieces, game->board.nbPieces, 0, textureHandler->textures[TEXTURE_PieceRed]); + drawPiecesPlayer(renderer, boardRect, game->board.arrPieces, game->board.nbPieces, 1, textureHandler->textures[TEXTURE_PieceViolet]); return true; } diff --git a/Pontu/src/view/PiecesDrawer.c b/Pontu/src/view/PiecesDrawer.c index 9e9b303..d22e2e7 100644 --- a/Pontu/src/view/PiecesDrawer.c +++ b/Pontu/src/view/PiecesDrawer.c @@ -16,11 +16,13 @@ SDL_Rect islandToRect(const SDL_Rect* boardRect, const Island island) { return r; } -void drawPieces(SDL_Renderer* renderer, const SDL_Rect* boardRect, const Piece arrPieces[], const size_t nbPieces, SDL_Texture* piece) { +void drawPiecesPlayer(SDL_Renderer* renderer, const SDL_Rect* boardRect, const Piece arrPieces[], const size_t nbPieces, const size_t numPlayer, SDL_Texture* piece) { for (size_t i = 0; i < nbPieces; ++i) { - const SDL_Rect rDest = islandToRect(boardRect, arrPieces[i].island); - SDL_RenderCopy(renderer, piece, NULL, &rDest); + if (arrPieces[i].idJ == numPlayer) { + const SDL_Rect rDest = islandToRect(boardRect, arrPieces[i].island); + SDL_RenderCopy(renderer, piece, NULL, &rDest); + } } }