modification newGame

origin/fixingSettings
Mathis RIBEMONT 4 years ago
parent d71beabbd7
commit 42636bca6e

@ -10,11 +10,12 @@
#include "../test/testConnectionMenu.c"*/ #include "../test/testConnectionMenu.c"*/
//#include "../test/testDrawMainMenu.c //#include "../test/testDrawMainMenu.c
//#include "../test/testSettingsView.c" //#include "../test/testSettingsView.c"
#include "../test/oldMain__ThisCanBeGameMain.c"
/* /*
This file is meant to be modified (used only to called other tests functions) This file is meant to be modified (used only to called other tests functions)
*/ */
int main(int argc, char *argv[]) { /*int main(int argc, char *argv[]) {
//testTextureLoader(); //testTextureLoader();
//testAudioHandler(); //testAudioHandler();
//testFontLoader(); //testFontLoader();
@ -22,11 +23,11 @@ int main(int argc, char *argv[]) {
//testTextInput(); //testTextInput();
//testButtonTextureLoader(); //testButtonTextureLoader();
//testConnectionMenu(); //testConnectionMenu();
testMenuEndGame(); //testMenuEndGame();
//testGameInterface(); //testGameInterface();
//testConnectionMenu(); //testConnectionMenu();
//testDrawMainMenu(); //testDrawMainMenu();
//testSettingsView(); //testSettingsView();
return 0; return 0;
} }*/

@ -47,7 +47,7 @@ typedef struct {
* \param[in] nbPlayers The number of players for this game * \param[in] nbPlayers The number of players for this game
* \return A struct representing the game * \return A struct representing the game
*/ */
Game newGame(const size_t nbPlayers, const char* pseudos[]); Game newGame(const size_t nbPlayers, const Player player[]);
/** /**
@ -189,4 +189,3 @@ bool rmBridge(Bridge bridge, Board* board);
struct array_Coord getInteractiveCases(const Game* const game, const Coord selectedCase); struct array_Coord getInteractiveCases(const Game* const game, const Coord selectedCase);
#endif //GAME_H #endif //GAME_H

@ -30,7 +30,7 @@ void applySpecificRulesFor2PlayersGame(Game* g)
} }
} }
Game newGame(const size_t nbPlayers, const char* pseudos[]) Game newGame(const size_t nbPlayers, const Player player[])
{ {
Game g = { // In Placement phase, the last player initialized is the 1st to play Game g = { // In Placement phase, the last player initialized is the 1st to play
.currentPlayerID = nbPlayers - 1, .currentPlayerID = nbPlayers - 1,
@ -40,13 +40,9 @@ Game newGame(const size_t nbPlayers, const char* pseudos[])
.nbPlayers = nbPlayers .nbPlayers = 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 } };
for (size_t player_i = 0; player_i < nbPlayers; player_i++) for (size_t player_i = 0; player_i < nbPlayers; player_i++)
{ {
g.arrPlayers[player_i] = newPlayer(pseudos[player_i], colors[player_i]); g.arrPlayers[player_i] = player[player_i];
} }
if (nbPlayers == 2) if (nbPlayers == 2)

@ -42,6 +42,7 @@ int main(int argc, char* argv[])
int wBoardRect=99*3, hBoardRect=99*3; int wBoardRect=99*3, hBoardRect=99*3;
SDL_Rect boardRect = {.x=windowSize.w/2 - wBoardRect/2, .y=windowSize.h/2 - hBoardRect/2, .w=wBoardRect, .h=99*3}; SDL_Rect boardRect = {.x=windowSize.w/2 - wBoardRect/2, .y=windowSize.h/2 - hBoardRect/2, .w=wBoardRect, .h=99*3};
const char* pseudos[] = {"Azerty","Bépo"}; const char* pseudos[] = {"Azerty","Bépo"};
const Player [2];
Game game = newGame(2, pseudos); Game game = newGame(2, pseudos);
TextureHandler textureHandler = newTextureHandler(renderer); TextureHandler textureHandler = newTextureHandler(renderer);

Loading…
Cancel
Save