Merge branch 'master' of https://gitlab.iut-clermont.uca.fr/maribemont/projet-tut
commit
ccea65a8c0
@ -0,0 +1,34 @@
|
||||
/**
|
||||
* \file Joueur.h
|
||||
* \brief Représente un joueur
|
||||
* \author Théotime Maillarbaux
|
||||
* \date 29/11/2021
|
||||
*/
|
||||
|
||||
#ifndef JOUEUR_H
|
||||
#define JOUEUR_H
|
||||
|
||||
#define PSEUDO_LENMAX 50
|
||||
|
||||
#include <SDL_pixels.h>
|
||||
|
||||
/**
|
||||
* \struct Joueur
|
||||
* \brief Joueur d'une partie
|
||||
*/
|
||||
typedef struct {
|
||||
char pseudo[PSEUDO_LENMAX]; //< Le pseudo du joueur
|
||||
SDL_Color couleur; //< La couleur des pions du joueur
|
||||
int classement; //< La position du joueur dans le classement (vaut 0 s'il n'est pas encore éliminé)
|
||||
} Joueur;
|
||||
|
||||
/**
|
||||
* \brief Crée un nouveau joueur
|
||||
* \param[in] pseudo Le pseudo du nouveau joueur
|
||||
* \param[in] couleur La couleur du nouveau joueur
|
||||
* \return Une structure représentant le nouveau joueur
|
||||
*/
|
||||
Joueur nouveauJoueur(char pseudo[PSEUDO_LENMAX], SDL_Color couleur);
|
||||
|
||||
|
||||
#endif // JOUEUR_H
|
@ -0,0 +1,44 @@
|
||||
/**
|
||||
* \file Partie.h
|
||||
* \brief Gestion de la partie
|
||||
* \author Théotime Maillarbaux
|
||||
* \date 29/11/2021
|
||||
*/
|
||||
|
||||
#ifndef PARTIE_H
|
||||
#define PARTIE_H
|
||||
|
||||
#include "model/Player.h"
|
||||
#include "model/Board.h"
|
||||
|
||||
|
||||
/**
|
||||
* \enum Etat
|
||||
* \brief Représente l'état de la partie en cours
|
||||
*/
|
||||
typedef enum {
|
||||
PLACEMENT,
|
||||
GAME
|
||||
} State;
|
||||
|
||||
/**
|
||||
* \struct Game
|
||||
* \brief Represents a game
|
||||
*/
|
||||
typedef struct {
|
||||
int currentPlayerID; ///< The ID of the one currently playing
|
||||
int nb_rounds; ///< The number of rounds so far
|
||||
//TODO duree
|
||||
State state; ///< The current state of the game
|
||||
Player arrPlayers[4]; ///< The array of all the players in this game
|
||||
Board board; ///< The board for this game
|
||||
} Game;
|
||||
|
||||
/**
|
||||
* \brief Makes a new Game
|
||||
* \param[in] nbPlayers The number of players for this game
|
||||
* \return A struct representing the game
|
||||
*/
|
||||
Game newGame(int nbPlayers);
|
||||
|
||||
#endif //PARTIE_H
|
@ -0,0 +1,13 @@
|
||||
#include "model/Game.h"
|
||||
|
||||
Game newGame(int nbPlayers) {
|
||||
Game g;
|
||||
// In Placement phase, the last player initialized is the 1st to play
|
||||
g.currentPlayerID = nbPlayers - 1;
|
||||
g.nb_rounds = 0;
|
||||
g.state = PLACEMENT;
|
||||
// TODO newBoard
|
||||
// TODO initPlayers (avec gestion des couleurs)
|
||||
return g;
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#include "modele/Joueur.h"
|
||||
|
||||
Joueur nouveauJoueur(char pseudo[PSEUDO_LENMAX],
|
||||
SDL_Color couleur) {
|
||||
Joueur joueur;
|
||||
strcpy(joueur.pseudo, pseudo);
|
||||
joueur.couleur = couleur;
|
||||
joueur.classement = 0;
|
||||
}
|
||||
|
Loading…
Reference in new issue