Skip to content
Snippets Groups Projects
Commit c418edda authored by Montjoie Henri's avatar Montjoie Henri
Browse files

creation d'un main_affichage qui appelle les autres fonctions #propre

parent 9e2da9ee
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,54 @@ EtatsJeu etat;
char* nom_1;
char* nom_2;
/*!
* \fn int main_affichage()
* \brief Fonction principale de la partie affichage, elle appelle les autres en fonction de l'etat du jeu
*
*/
int main_affichage()
{
etat=LANCEMENT;/*lance le jeu direct l'ecran de lancement, sans rentrer les noms des joueurs*/
//etat=SAISIE_JOUEURS; /*lance le jeu l'ecran "entrer nom joueur 1"*/
if (SDL_Init(SDL_INIT_VIDEO)<0)
{
printf("Unable to init SDL: %s\n", SDL_GetError());
exit(EXIT_FAILURE);
}
if(TTF_Init()==-1)
{
fprintf(stderr, "Erreur d'initialisation de TTF_Init : %s\n", TTF_GetError());
exit(EXIT_FAILURE);
}
while(etat!=FERMER)
{
switch(etat)
{
case SAISIE_JOUEURS:
saisie_noms_joueurs();
break;
case LANCEMENT:
affichage_ecran_accueil();
break;
case CONFIGURATION:
affichage_menu_configuration();
break;
case TOUR_J1P1:
affichage_carte(NULL);
break;
default:
break;
}
}
SDL_Quit();
return 0;
}
/*!
* \fn char* afficherListeClasses(char** nomsClasses, char** skinsClasses, int nbChoix, TTF_Font* police,SDL_Color couleurTexte)
* \brief Fonction permettant le choix de la classe d'un personnage par le joueur
......@@ -101,17 +149,6 @@ int saisie_noms_joueurs()
SDL_Rect pos_texte;
TTF_Font *police = NULL;
if ( SDL_Init( SDL_INIT_VIDEO ) < 0 )
{
printf( "Unable to init SDL: %s\n", SDL_GetError() );
return 1;
}
if(TTF_Init() == -1)
{
fprintf(stderr, "Erreur d'initialisation de TTF_Init : %s\n", TTF_GetError());
exit(EXIT_FAILURE);
}
SDL_Color couleurNoire = {0, 0, 0};
SDL_Color couleurBlanche = {255, 255, 255};
......@@ -171,13 +208,12 @@ int saisie_noms_joueurs()
nom_1=nom_joueur1;
nom_2=nom_joueur2;
if(etat==LANCEMENT) affichage_ecran_accueil();
return 0;
}
/*!
* \fn int affichage_menu_configuration()
* \fn int affichage_ecran_accueil()
* \brief fonction qui gre l'affichage de l'ecran d'accueil (logo + bouton de lancement)
*/
int affichage_ecran_accueil()
......@@ -194,7 +230,7 @@ int affichage_ecran_accueil()
if ( SDL_Init( SDL_INIT_VIDEO ) < 0 )
{
printf( "Unable to init SDL: %s\n", SDL_GetError() );
return 1;
exit(EXIT_FAILURE);
}
if(TTF_Init() == -1)
{
......@@ -254,7 +290,6 @@ int affichage_ecran_accueil()
SDL_BlitSurface(rectangle,NULL,ecran,&pos_texte);
SDL_Flip(ecran);
}
if(etat==CONFIGURATION) affichage_menu_configuration();
return 0;
}
......@@ -460,7 +495,6 @@ int affichage_menu_configuration()
p=0;
j=0;
}
SDL_Quit();
return 0;
}
......
......@@ -15,6 +15,7 @@
#define HAUTEUR_BOUTON 20
#define LARGEUR_BOUTON 115
int main_affichage();
int saisie_noms_joueurs();
......
......@@ -47,7 +47,7 @@ int ajouter_effet_perso(Effet *effet_select, Personnage *cible)
*/
int appliquer_effet(Effet *effet_select, Personnage *cible)
{
(cible->PV) -= (effet_select->valeur_degats)
(cible->PV) -= (effet_select->valeur_degats);
}
......
......@@ -90,8 +90,7 @@ int main(void)
initJeu();
//saisie_noms_joueurs(); /*lance le jeu l'ecran "entrer nom joueur 1"*/
//affichage_ecran_accueil(); /*lance le jeu direct l'ecran de lancement, sans rentrer les noms des joueurs*/
main_affichage();
return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment