commit
2200a2094c
@ -1,25 +1,25 @@
|
|||||||
/**
|
/**
|
||||||
* \file Partie.h
|
* \file Game.h
|
||||||
* \brief Gestion de la partie
|
* \brief Management of a Game
|
||||||
* \author Théotime Maillarbaux
|
* \author Théotime Maillarbaux
|
||||||
* \date 29/11/2021
|
* \date 29/11/2021
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PARTIE_H
|
#ifndef GAME_H
|
||||||
#define PARTIE_H
|
#define GAME_H
|
||||||
|
|
||||||
#include "model/Player.h"
|
#include "model/Player.h"
|
||||||
#include "model/Board.h"
|
#include "model/Board.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \enum Etat
|
* \enum Phase
|
||||||
* \brief Représente l'état de la partie en cours
|
* \brief Represents the phase of the current game
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PLACEMENT,
|
PLACEMENT,
|
||||||
GAME
|
GAME
|
||||||
} State;
|
} Phase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \struct Game
|
* \struct Game
|
@ -0,0 +1,35 @@
|
|||||||
|
/**
|
||||||
|
* \file Player.h
|
||||||
|
* \brief Represents a player
|
||||||
|
* \author Théotime Maillarbaux
|
||||||
|
* \date 29/11/2021
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PLAYER_H
|
||||||
|
#define PLAYER_H
|
||||||
|
|
||||||
|
#define PSEUDO_LENMAX 50
|
||||||
|
|
||||||
|
#include <SDL_pixels.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \struct Player
|
||||||
|
* \brief Player during a game
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
char pseudo[PSEUDO_LENMAX]; //< The player's pseudo
|
||||||
|
SDL_Color color; //< The player's Piece' color
|
||||||
|
int rank; //< The player's rank (0 if the player isn't out yet)
|
||||||
|
} Joueur;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Creates a new Player
|
||||||
|
* \param[in] pseudo The new Player's pseudo
|
||||||
|
* \param[in] color The color of the new Player's Piece
|
||||||
|
* \return A struct representing the new Player
|
||||||
|
*/
|
||||||
|
Player newPlayer(char pseudo[PSEUDO_LENMAX], SDL_Color color);
|
||||||
|
|
||||||
|
|
||||||
|
#endif // JOUEUR_H
|
@ -1,34 +0,0 @@
|
|||||||
/**
|
|
||||||
* \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,10 @@
|
|||||||
|
#include "model/Player.h"
|
||||||
|
|
||||||
|
Player newPlayer(char pseudo[PSEUDO_LENMAX],
|
||||||
|
SDL_Color color) {
|
||||||
|
Player player;
|
||||||
|
strcpy(player.pseudo, pseudo);
|
||||||
|
player.color = color;
|
||||||
|
player.rank = 0;
|
||||||
|
}
|
||||||
|
|
@ -1,10 +0,0 @@
|
|||||||
#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