From 5bb4a3a81abe7423f124f71e08d9b9803727b5d4 Mon Sep 17 00:00:00 2001 From: ColinDrieu <colin.drieu@insa-rennes.fr> Date: Tue, 3 May 2016 16:11:22 +0200 Subject: [PATCH] =?UTF-8?q?Suppression=20des=20fichiers=20li=C3=A9s=20?= =?UTF-8?q?=C3=A0=20l'affiche=20console.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit J'ai supprimmÊ les fichiers liÊs à l'affiche console qui ne nous servirons plus. J'ai retirÊ les fonctions du fichiers controleur.c qui Êtait dÊdiÊe à l'affichage en console. J'ajouterai de nouvelles fonctions dans controleur.c pour l'affichage avec la SDL. --- src/AffichageConsole.c | 81 ----------------------------------------- src/AffichageConsole.h | 17 --------- src/affichageConsole2.c | 77 --------------------------------------- src/affichageConsole2.h | 16 -------- src/controleur.c | 65 --------------------------------- src/controleur.h | 5 --- src/mainPartieConsole.c | 66 --------------------------------- 7 files changed, 327 deletions(-) delete mode 100644 src/AffichageConsole.c delete mode 100644 src/AffichageConsole.h delete mode 100644 src/affichageConsole2.c delete mode 100644 src/affichageConsole2.h delete mode 100644 src/mainPartieConsole.c diff --git a/src/AffichageConsole.c b/src/AffichageConsole.c deleted file mode 100644 index e0099b5..0000000 --- a/src/AffichageConsole.c +++ /dev/null @@ -1,81 +0,0 @@ -/*! -* \file AffichageConsole.c -* \brief Fichier contenant le code des fonctions liees a la structure AffichageConsole. -*/ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include "AffichageConsole.h" -#include "partie.h" -#include "joueur.h" -#include "joueurList.h" -#include "personnage.h" -#include "case.h" - -/*! - * \fn void afficheEnsembleJoueur(Partie *p) - * \brief La fonction permet d'afficher le nom de chaque joueur avec leur personnage et ses coordonnees. - * - * \param Un pointeur vers les joueur a afficher avec leur personnage et ses coordonnees. - */ - -void afficheEnsembleJoueur(Partie *p){ - Joueur * Temporaire = getCurrentJoueur(p->participants); /* On sauve l'emplacement du current actuel*/ - setOnFirstJoueur(p->participants); /* On se positionne sur le premier joueur*/ - while(!outOfJoueurList(p->participants)){ /*Tant qu'on est pas arrivé au dernier current*/ - afficheNomJoueur(getCurrentJoueur(p->participants)); - afficheNomPersonnage(getPersonnage(getCurrentJoueur(getListJoueur(p)),0)); - afficheCoordonneesPersonnage(getPosition(getPersonnage(getCurrentJoueur(getListJoueur(p)),0))); - nextJoueur(p->participants); - } - /*On affiche le dernier current (personnage)*/ - afficheNomJoueur(getCurrentJoueur(p->participants)); - afficheNomPersonnage(getPersonnage(getCurrentJoueur(getListJoueur(p)),0)); - afficheCoordonneesPersonnage(getPosition(getPersonnage(getCurrentJoueur(getListJoueur(p)),0))); - - setOnJoueur(p->participants, Temporaire); /* On retourne sur le current original*/ -} - -/*! - * \fn void afficheNomJoueur(Joueur * j) - * \brief La fonction permet d'afficher le nom du joueur. - * - * \param Un pointeur vers le joueur a afficher. - */ -void afficheNomJoueur(Joueur * j){ - printf("Joueur: %s\n", getNomJoueur(j)); -} - -/*! - * \fn void afficheNomPersonnage(Personnage * p) - * \brief La fonction permet d'afficher le nom du personnage. - * - * \param Un pointeur vers le personnage a afficher. - */ -void afficheNomPersonnage(Personnage * p){ - /*printf("Personnage: %s\n", getPersonnage(p)); Il n'y a pas de fonction pour récupérer le nom du personnage */ -} - -/*! - * \fn void afficheCoordoneesPersonnage(Case * c) - * \brief La fonction permet d'afficher les coordonnees du personnage. - * - * \param Un pointeur vers les coordonnees du personnage a afficher. - */ -void afficheCoordonneesPersonnage(Case *c){ - printf("Coordonnées: \n x = %d\n y = %d \n", get_x(c), get_y(c)); -} - -/*! - * \fn void afficheEtatPersonnage(Personnage * p) - * \brief La fonction permet d'afficher l'etat du personnage. - * - * \param Un pointeur vers l'etat du personnage a afficher. - */ -void afficheEtatPersonnage(Personnage *p){ - afficheNomPersonnage(p); - printf("Points de déplacement: %d\n", get_PD(p)); - printf("Points de vie: %d\n", get_PV(p)); - printf("Mana: %d\n", get_mana(p)); -} diff --git a/src/AffichageConsole.h b/src/AffichageConsole.h deleted file mode 100644 index 9b35f7f..0000000 --- a/src/AffichageConsole.h +++ /dev/null @@ -1,17 +0,0 @@ -/*! -* \file AffichageConsole.h -* \brief Fichier contenant les signatures des fonctions liees a la structure AffichageConsole. -*/ - -#ifndef AFFICHAGECONSOLE_H -#define AFFICHAGECONSOLE_H - -#include "structures.h" - -void afficheEnsembleJoueur(Partie *p); -void afficheNomJoueur(Joueur * j); -void afficheNomPersonnage(Personnage * p); -void afficheCoordonneesPersonnage(Case *c); -void afficheEtatPersonnage(Personnage *p); - -#endif // AFFICHAGECONSOLE_H diff --git a/src/affichageConsole2.c b/src/affichageConsole2.c deleted file mode 100644 index 2def0fc..0000000 --- a/src/affichageConsole2.c +++ /dev/null @@ -1,77 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> - -/*! - * \fn void affichePremierChoix(Partie * p, int * i) - * \brief La fonction affiche le choix offert et modifie la variable entiere donnee en entree. - * - * \param un pointeur vers le premier caractere d'un tableau (il contient le nom du Joueur, voir le controleur), un pointeur vers un entier representant la variable de choix a modifier. - */ -void affichePremierChoix(char * c, int * i){ - printf("%s : Que voulez-vous faire?\n 1-Sélectionner un personnage\n 2-Fin du tour\n", c); - scanf("%d",i); - printf("\n"); -} - -/*! - * \fn void afficherEntrerCoordonnees(int * cX, int * cY) - * \brief La fonction affiche une requete au Joueur et modifie les variable entiere pointee par les entrees en fonction des entrees clavier. - * - * \param les pointeurs vers les entiers representant les coordonnees a modifier. - */ - void afficherEntrerCoordonnees(int * cX, int * cY){ - printf("Entrez une abscisse : x = "); - scanf("%d",cX); - printf("\n"); - printf("Entrez une ordonnée : y = "); - scanf("%d",cY); - printf("\n"); - } - - /*! - * \fn void afficherChoixImpossible() - * \brief La fonction affiche un message - */ - void afficherChoixImpossible(){ - printf("Vous ne pouvez pas faire įa."); - } - - /*! - * \fn void afficheFinTour(char * c) - * \brief La fonction affiche une un message de fin de tour. - * - * \param Un pointeur vers le premier caractere du nom du Joueur dont ca va etre le tour (voir l'appel dans controlleur.c) - */ - void afficheFinTour(char * c){ - printf("Fin du tour.\n Nouveau tour : Tour de %s",c); - } - - /*! - * \fn void afficheEtatPersonnage(char * nomJoueur, char * nomPersonnage, char * nomClasse, int * caracteristiques) - * \brief La fonction affiche les informations concernant l'etat d'un Personnage - * - * \param Un pointeur vers des chaines de caracteres et un tableau d'entier representant respectivement : - * le nom du Joueur possedant le Personnage - * le nom du Personnage - * le nom de sa Classe - * ses points de vie actuels et maximum - * son mana actuel et maximum - * ses points de deplacement actuels et maximum - */ - void afficheCaracteristiquesPersonnage(char * nomJoueur, char * nomPersonnage, char * nomClasse, int * caracteristiques){ - printf("%s : %s\n %s \n", nomPersonnage, nomClasse, nomJoueur); - printf("PV : %d/%d \n Mana : %d/%d \n PD : %d/%d \n", caracteristiques[0], caracteristiques[1], caracteristiques[2], caracteristiques[3], caracteristiques[4], caracteristiques[5]); - } - - /*! - * \fn void affichePremierChoix(Partie * p, int * i) - * \brief La fonction affiche le choix offert pour l'action d'un Personnage et modifie la variable entiere donnee en entree. - * - * \param un pointeur vers les premiers caracteres de tableaux (ils contiennent le nom du Joueur et le nom du Personnage respectivement, voir le controleur), - * un pointeur vers un entier representant la variable de choix a modifier. - */ - void afficheChoixActionPersonnage(char * nJ, char * nP, int * i){ - printf("%s : %s \n Que voulez vous faire ?\n", nJ,nP); - printf("1- Attaque \n 2- Déplacement \n 3- Retour ā la selection de Personnage \n, Fin du Tour"); - scanf("%d",i); - } diff --git a/src/affichageConsole2.h b/src/affichageConsole2.h deleted file mode 100644 index b7793b7..0000000 --- a/src/affichageConsole2.h +++ /dev/null @@ -1,16 +0,0 @@ -/*! -* \file affichageConsole2.h -* \brief Fichier contenant les signatures des fonctions liees a la structure AffichageConsole. -*/ - -#ifndef AFFICHAGECONSOLE2_H -#define AFFICHAGECONSOLE2_H - -void affichePremierChoix(char * c, int * i); -void afficheChoixActionPersonnage(char * nJ, char * nP, int * i); -void afficherChoixImpossible(); -void afficherEntrerCoordonnees(int * cX, int * cY); -void afficheFinTour(char * c); -void afficheCaracteristiquesPersonnage(char * nomJoueur, char * nomPersonnage, char * nomClasse, int * caracteristiques); - -#endif // AFFICHAGECONSOLE2_H diff --git a/src/controleur.c b/src/controleur.c index dd2c66a..2e9c69e 100644 --- a/src/controleur.c +++ b/src/controleur.c @@ -14,68 +14,3 @@ #include "personnage.h" #include "classe.h" - /*! - * \fn int choixPrincipal() - * \brief La fonction fait l'interface entre le moteur et l'affichage du jeu pour le premier choix principal d'un Joueur lors de son tour. - * - * \param La Partie p en cours. - * \return un entier representant la valeur du choix du Joueur. - */ -int choixPrincipal(Partie * p){ - int choix; - choix = 0; - affichePremierChoix(getNomJoueur(getCurrentJoueur(getListJoueur(p))),&choix); - return choix; -} - - /*! - * \fn int choixActionPersonnage(Partie * p) - * \brief La fonction fait l'interface entre le moteur et l'affichage du jeu pour le choix d'une action d'un Personnage. - * - * \param La Partie p en cours. - * \return un entier representant la valeur du choix du Joueur. - */ -int choixActionPersonnage(Partie * p, Personnage * persSel, Joueur * j){ - int i; - i=0; - afficheChoixActionPersonnage(getNomJoueur(j),getNomPersonnage(persSel),&i); - return i; -} - - /*! - * \fn Case * entrerCoordonnees(Partie * p) - * \brief La fonction fait l'interface entre le moteur et l'affichage du jeu pour la saisie de coordonnees. - * - * \param La Partie p en cours. - * \return Un pointeur vers la Case aux coordonnees entrees, NULL si les coordonnees ne sont pas valides. - */ -Case * entrerCoordonnees(Partie * p){ - int x, y; - Case * caseTemp = NULL; - x=-1; - y=-1; - afficherEntrerCoordonnees(&x,&y); - caseTemp=trouverCase(getCarte(p),x,y); - return caseTemp; -} - - /*! - * \fn void personnageSelectionne(Partie * p) - * \brief La fonction fait l'interface entre le moteur du jeu et l'affichage pour l'affichage des caracteristiques d'un Personnage. - * - * \param La Partie p en cours. - */ -void personnageSelectionne(Partie * p, Personnage * personnageSel){ - char * nP = getNomPersonnage(personnageSel); - char * nC = getNomClasse(getClasse(personnageSel)); - char * nJ = getNomJoueur(appartientJoueur(personnageSel,p)); - int etat[6]={ - get_PV(personnageSel), - getPVMax(getClasse(personnageSel)), - get_mana(personnageSel), - getManaMax(getClasse(personnageSel)), - get_PD(personnageSel), - getPDMax(getClasse(personnageSel)) - }; - afficheCaracteristiquesPersonnage(nJ,nP,nC,etat); -} diff --git a/src/controleur.h b/src/controleur.h index af3126d..2218425 100644 --- a/src/controleur.h +++ b/src/controleur.h @@ -8,11 +8,6 @@ #ifndef CONTROLEUR_H #define CONTROLEUR_H -int choixPrincipal(Partie * p); -Case * entrerCoordonnees(Partie * p); -Personnage * coordonneesValidesPersonnage(Partie * p, Case * c); -int choixActionPersonnage(Partie * p); -void personnageSelectionne(Partie * p, Personnage * personnageSel); #endif // CONTROLEUR_H diff --git a/src/mainPartieConsole.c b/src/mainPartieConsole.c deleted file mode 100644 index 04a4044..0000000 --- a/src/mainPartieConsole.c +++ /dev/null @@ -1,66 +0,0 @@ -#include <stdlib.h> -#include <stdio.h> -#include <string.h> - -#include "structures.h" -#include "controleur.h" -#include "partie.h" -#include "personnage.h" -#include "joueurList.h" -#include "joueur.h" -#include "affichageConsole2.h" - - -int mainPartieConsole(){ - //initialisation - Case * caseSel = NULL; - Personnage * persSel = NULL; - Partie * partieEnCours=initPartie(); - //Partie - while(!victoire(partieEnCours)){ - switch(choixPrincipal(partieEnCours)){ - case 1:{ - caseSel = entrerCoordonnees(partieEnCours); - if(caseSel!=NULL){ - persSel = coordonneesValidesPersonnage(partieEnCours,caseSel); - if(persSel!=NULL){ - personnageSelectionne(partieEnCours,persSel); - if((isTurn(partieEnCours, appartientJoueur(persSel, partieEnCours)))){ - switch (choixActionPersonnage(partieEnCours)){ - case 1:{ - //Attaque - } - case 2:{ - //Deplacement - } - case 3:{ - //retour au choix principal. - } - case 4:{ - finTour(partieEnCours); - afficheFinTour(getNomJoueur(getCurrentJoueur(getListJoueur(partieEnCours)))); - } - default:{ - afficherChoixImpossible(); - } - } - } - } - else{ - afficherChoixImpossible(); - } - } - else{ - afficherChoixImpossible(); - } - } - case 2:{ - finTour(partieEnCours); - afficheFinTour(getNomJoueur(getCurrentJoueur(getListJoueur(partieEnCours)))); - } - default:{ - afficherChoixImpossible(); - } - } - } -} -- GitLab