From 9b80275cbbe32067d66d6bbffbcde62a4a896a84 Mon Sep 17 00:00:00 2001 From: thmaillarb Date: Mon, 29 Nov 2021 11:38:32 +0100 Subject: [PATCH] Players are added to the game --- Pontu/include/model/Game.h | 2 +- Pontu/src/model/Game.c | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Pontu/include/model/Game.h b/Pontu/include/model/Game.h index 4a601c4..f347edc 100644 --- a/Pontu/include/model/Game.h +++ b/Pontu/include/model/Game.h @@ -10,7 +10,7 @@ #include "model/Player.h" #include "model/Board.h" - +#include /** * \enum Phase diff --git a/Pontu/src/model/Game.c b/Pontu/src/model/Game.c index bb20325..884a220 100644 --- a/Pontu/src/model/Game.c +++ b/Pontu/src/model/Game.c @@ -6,8 +6,22 @@ Game newGame(int nbPlayers) { g.currentPlayerID = nbPlayers - 1; g.nb_rounds = 0; g.state = PLACEMENT; - // TODO newBoard - // TODO initPlayers (avec gestion des couleurs) + g.board = newBoard(nbPlayers); + + // red, green, blue, yellow + // TODO meilleures couleurs (?) + SDL_Color colors[4] { + {255,0 ,0 ,255}, + {0 ,255,0 ,255}, + {0 ,0 ,255,255}, + {255,255,0 ,255} + }; + + // TODO récup pseudos + for (int player_i = 0; player_i < nbPlayers; player_i++) { + g.arrPlayers[player_i] = newPlayer("Pseudo",colors[player_i]); + } + return g; }