Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lemeilleurjeudumonde
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tacticalrpg
lemeilleurjeudumonde
Commits
1dbda66d
There was a problem fetching the pipeline summary.
Commit
1dbda66d
authored
8 years ago
by
Montjoie Henri
Browse files
Options
Downloads
Patches
Plain Diff
gestion des PV
parent
5f7a584b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/affichage.c
+33
-25
33 additions, 25 deletions
src/affichage.c
with
33 additions
and
25 deletions
src/affichage.c
+
33
−
25
View file @
1dbda66d
...
@@ -65,15 +65,17 @@ int main_affichage()
...
@@ -65,15 +65,17 @@ int main_affichage()
return
0
;
return
0
;
}
}
void
perso_suivant
(
int
*
numPerso
){
int
perso_suivant
(
int
numPerso
){
if
(
*
numPerso
==
NB_PERSO
)
*
numPerso
=
1
;
if
(
numPerso
==
NB_PERSO
)
numPerso
=
1
;
else
if
(
*
numPerso
==
NB_PERSO
*
2
)
*
numPerso
=
NB_PERSO
+
1
;
else
if
(
numPerso
==
NB_PERSO
*
2
)
numPerso
=
NB_PERSO
+
1
;
else
*
numPerso
++
;
else
numPerso
++
;
return
numPerso
;
}
}
void
actualiser_num_perso
(
int
*
numPerso
){
int
actualiser_num_perso
(
int
numPerso
){
if
(
*
numPerso
<=
NB_PERSO
)
*
numPerso
=
NB_PERSO
+
1
;
if
(
numPerso
<=
NB_PERSO
)
numPerso
=
NB_PERSO
+
1
;
else
*
numPerso
=
1
;
else
numPerso
=
1
;
return
numPerso
;
}
}
/*!
/*!
...
@@ -654,17 +656,17 @@ int affichage_carte()
...
@@ -654,17 +656,17 @@ int affichage_carte()
{
{
int
i
,
j
,
y
=
0
;
int
i
,
j
,
y
=
0
;
int
x
=
0
;
int
x
=
0
;
int
perso_
select
=
1
;
int
perso_
actuel
=
1
;
SDL_Event
event
;
SDL_Event
event
;
SDL_Surface
*
ecran
=
SDL_SetVideoMode
(
LARGEUR_CARTE
*
(
LARGEUR_CASE
)
+
LARGEUR_BORDURE
,
HAUTEUR_CARTE
*
(
HAUTEUR_CASE
+
2
),
32
,
SDL_HWSURFACE
|
SDL_DOUBLEBUF
);;
SDL_Surface
*
ecran
=
SDL_SetVideoMode
(
LARGEUR_CARTE
*
(
LARGEUR_CASE
)
+
LARGEUR_BORDURE
,
HAUTEUR_CARTE
*
(
HAUTEUR_CASE
+
2
),
32
,
SDL_HWSURFACE
|
SDL_DOUBLEBUF
);;
SDL_Surface
*
cases
[
HAUTEUR_CARTE
][
LARGEUR_CARTE
];
SDL_Surface
*
cases
[
HAUTEUR_CARTE
][
LARGEUR_CARTE
];
SDL_Surface
*
persos
[
NB_PERSO
*
NB_JOUEURS
];
SDL_Surface
*
persos
[
NB_PERSO
*
NB_JOUEURS
];
SDL_Surface
*
Case_brillante
=
NULL
;
SDL_Surface
*
Case_brillante
=
NULL
;
SDL_Surface
*
Guerrier
_select
=
NULL
;
SDL_Surface
*
perso
_select
=
NULL
;
SDL_Rect
Position_Case
[
HAUTEUR_CARTE
][
LARGEUR_CARTE
];
SDL_Rect
Position_Case
[
HAUTEUR_CARTE
][
LARGEUR_CARTE
];
SDL_Rect
Position_Perso
[
NB_PERSO
*
NB_JOUEURS
];
SDL_Rect
Position_Perso
[
NB_PERSO
*
NB_JOUEURS
];
SDL_Rect
Position_Case_brillante
;
SDL_Rect
Position_Case_brillante
;
SDL_Rect
P
osition_
Guerrier
_select
;
SDL_Rect
p
osition_
perso
_select
;
SDL_Surface
*
PV
=
NULL
;
SDL_Surface
*
PV
=
NULL
;
SDL_Surface
*
texte
=
NULL
;
SDL_Surface
*
texte
=
NULL
;
...
@@ -688,9 +690,10 @@ int affichage_carte()
...
@@ -688,9 +690,10 @@ int affichage_carte()
nom_joueur
=
TTF_RenderText_Shaded
(
vieille_police
,
nom_1
,
couleurBlanche
,
couleurNoire
);
nom_joueur
=
TTF_RenderText_Shaded
(
vieille_police
,
nom_1
,
couleurBlanche
,
couleurNoire
);
bouton1
=
TTF_RenderText_Shaded
(
vieille_police
,
"Perso suivant"
,
couleurDoree
,
couleurBleue
);
bouton1
=
TTF_RenderText_Shaded
(
vieille_police
,
"Perso suivant"
,
couleurDoree
,
couleurBleue
);
bouton2
=
TTF_RenderText_Shaded
(
vieille_police
,
"Joueur suivant"
,
couleurDoree
,
couleurBleue
);
bouton2
=
TTF_RenderText_Shaded
(
vieille_police
,
"Joueur suivant"
,
couleurDoree
,
couleurBleue
);
/*char* buffer_PV;
sprintf(buffer_PV, "%d/%d", obtenirPVPersonnage(perso_select),obtenirPVMaxPersonnage(perso_select));
char
buffer_PV
[
9
];
PV=TTF_RenderText_Shaded(vieille_police, buffer_PV, couleurBlanche, couleurNoire);*/
sprintf
(
buffer_PV
,
"%d/%d"
,
obtenirPVPersonnage
(
perso_actuel
),
obtenirPVMaxPersonnage
(
perso_actuel
));
PV
=
TTF_RenderText_Shaded
(
vieille_police
,
buffer_PV
,
couleurBlanche
,
couleurNoire
);
pos_texte
.
x
=
ecran
->
w
-
(
LARGEUR_BORDURE
+
texte
->
w
)
/
2
;
pos_texte
.
x
=
ecran
->
w
-
(
LARGEUR_BORDURE
+
texte
->
w
)
/
2
;
pos_texte
.
y
=
20
;
pos_texte
.
y
=
20
;
...
@@ -700,8 +703,8 @@ int affichage_carte()
...
@@ -700,8 +703,8 @@ int affichage_carte()
pos_bouton2
.
y
=
ecran
->
h
-
bouton2
->
h
-
40
;
pos_bouton2
.
y
=
ecran
->
h
-
bouton2
->
h
-
40
;
pos_bouton1
.
x
=
ecran
->
w
-
(
LARGEUR_BORDURE
+
bouton1
->
w
)
/
2
;
pos_bouton1
.
x
=
ecran
->
w
-
(
LARGEUR_BORDURE
+
bouton1
->
w
)
/
2
;
pos_bouton1
.
y
=
pos_bouton2
.
y
-
(
2
*
bouton2
->
h
);
pos_bouton1
.
y
=
pos_bouton2
.
y
-
(
2
*
bouton2
->
h
);
/*
pos_PV.x=ecran->w-(LARGEUR_BORDURE+PV->w)/2;
pos_PV
.
x
=
ecran
->
w
-
(
LARGEUR_BORDURE
+
PV
->
w
)
/
2
;
pos_PV.y=pos_nom_joueur.y+(2*nom_joueur->h);
*/
pos_PV
.
y
=
pos_nom_joueur
.
y
+
(
2
*
nom_joueur
->
h
);
for
(
i
=
0
;
i
<
LARGEUR_CARTE
;
i
++
)
for
(
i
=
0
;
i
<
LARGEUR_CARTE
;
i
++
)
{
{
...
@@ -728,13 +731,13 @@ int affichage_carte()
...
@@ -728,13 +731,13 @@ int affichage_carte()
SDL_SetColorKey
(
persos
[
i
],
SDL_SRCCOLORKEY
,
SDL_MapRGB
(
persos
[
i
]
->
format
,
0
,
0
,
255
));
SDL_SetColorKey
(
persos
[
i
],
SDL_SRCCOLORKEY
,
SDL_MapRGB
(
persos
[
i
]
->
format
,
0
,
0
,
255
));
}
}
Guerrier
_select
=
SDL_LoadBMP
(
"../resources/Skins/guerrier_select.bmp"
);
perso
_select
=
SDL_LoadBMP
(
"../resources/Skins/guerrier_select.bmp"
);
if
(
!
Guerrier
_select
)
if
(
!
perso
_select
)
{
{
printf
(
"Unable to load bitmap: %s
\n
"
,
SDL_GetError
());
printf
(
"Unable to load bitmap: %s
\n
"
,
SDL_GetError
());
return
1
;
return
1
;
}
}
SDL_SetColorKey
(
Guerrier
_select
,
SDL_SRCCOLORKEY
,
SDL_MapRGB
(
Guerrier
_select
->
format
,
0
,
0
,
255
));
SDL_SetColorKey
(
perso
_select
,
SDL_SRCCOLORKEY
,
SDL_MapRGB
(
perso
_select
->
format
,
0
,
0
,
255
));
Case_brillante
=
SDL_LoadBMP
(
"../resources/Skins/case_brillante.bmp"
);
Case_brillante
=
SDL_LoadBMP
(
"../resources/Skins/case_brillante.bmp"
);
if
(
!
Case_brillante
)
if
(
!
Case_brillante
)
...
@@ -767,12 +770,17 @@ int affichage_carte()
...
@@ -767,12 +770,17 @@ int affichage_carte()
break
;
break
;
case
SDL_MOUSEBUTTONDOWN
:
case
SDL_MOUSEBUTTONDOWN
:
if
(
event
.
button
.
y
>
pos_bouton1
.
y
&&
event
.
button
.
y
<
pos_bouton1
.
y
+
bouton1
->
h
){
if
(
event
.
button
.
y
>
pos_bouton1
.
y
&&
event
.
button
.
y
<
pos_bouton1
.
y
+
bouton1
->
h
){
perso_suivant
(
&
perso_select
);
perso_actuel
=
perso_suivant
(
perso_actuel
);
sprintf
(
buffer_PV
,
"%d/%d"
,
obtenirPVPersonnage
(
perso_actuel
),
obtenirPVMaxPersonnage
(
perso_actuel
));
PV
=
TTF_RenderText_Shaded
(
vieille_police
,
buffer_PV
,
couleurBlanche
,
couleurNoire
);
}
}
if
(
event
.
button
.
y
>
pos_bouton2
.
y
&&
event
.
button
.
y
<
pos_bouton2
.
y
+
bouton2
->
h
){
if
(
event
.
button
.
y
>
pos_bouton2
.
y
&&
event
.
button
.
y
<
pos_bouton2
.
y
+
bouton2
->
h
){
//fin_du_tour();
finDuTour
();
//nom_joueur= TTF_RenderText_Shaded(vieille_police, obtenirNomJoueur(), couleurBlanche, couleurNoire);
debutDuTour
();
actualiser_num_perso
(
&
perso_select
);
nom_joueur
=
TTF_RenderText_Shaded
(
vieille_police
,
obtenirNomJoueurCourant
(),
couleurBlanche
,
couleurNoire
);
actualiser_num_perso
(
perso_actuel
);
sprintf
(
buffer_PV
,
"%d/%d"
,
obtenirPVPersonnage
(
perso_actuel
),
obtenirPVMaxPersonnage
(
perso_actuel
));
PV
=
TTF_RenderText_Shaded
(
vieille_police
,
buffer_PV
,
couleurBlanche
,
couleurNoire
);
}
}
if
(
event
.
button
.
x
<
LARGEUR_CARTE
*
LARGEUR_CASE
){
if
(
event
.
button
.
x
<
LARGEUR_CARTE
*
LARGEUR_CASE
){
//deplacement_personnage(event.button.x,event.button.y);
//deplacement_personnage(event.button.x,event.button.y);
...
@@ -827,7 +835,7 @@ int affichage_carte()
...
@@ -827,7 +835,7 @@ int affichage_carte()
}
}
/*SDL_BlitSurface(Guerrier_select,NULL,ecran,&Position_Guerrier_select);*/
/*SDL_BlitSurface(Guerrier_select,NULL,ecran,&Position_Guerrier_select);*/
SDL_BlitSurface
(
Case_brillante
,
NULL
,
ecran
,
&
Position_Case_brillante
);
SDL_BlitSurface
(
Case_brillante
,
NULL
,
ecran
,
&
Position_Case_brillante
);
//
SDL_BlitSurface(PV,NULL,ecran,&pos_PV);
SDL_BlitSurface
(
PV
,
NULL
,
ecran
,
&
pos_PV
);
SDL_BlitSurface
(
texte
,
NULL
,
ecran
,
&
pos_texte
);
SDL_BlitSurface
(
texte
,
NULL
,
ecran
,
&
pos_texte
);
SDL_BlitSurface
(
nom_joueur
,
NULL
,
ecran
,
&
pos_nom_joueur
);
SDL_BlitSurface
(
nom_joueur
,
NULL
,
ecran
,
&
pos_nom_joueur
);
SDL_BlitSurface
(
bouton1
,
NULL
,
ecran
,
&
pos_bouton1
);
SDL_BlitSurface
(
bouton1
,
NULL
,
ecran
,
&
pos_bouton1
);
...
@@ -845,12 +853,12 @@ int affichage_carte()
...
@@ -845,12 +853,12 @@ int affichage_carte()
SDL_FreeSurface
(
persos
[
i
]);
SDL_FreeSurface
(
persos
[
i
]);
}
}
SDL_FreeSurface
(
Case_brillante
);
SDL_FreeSurface
(
Case_brillante
);
SDL_FreeSurface
(
Guerrier
_select
);
SDL_FreeSurface
(
perso
_select
);
SDL_FreeSurface
(
texte
);
SDL_FreeSurface
(
texte
);
SDL_FreeSurface
(
nom_joueur
);
SDL_FreeSurface
(
nom_joueur
);
SDL_FreeSurface
(
bouton1
);
SDL_FreeSurface
(
bouton1
);
SDL_FreeSurface
(
bouton2
);
SDL_FreeSurface
(
bouton2
);
//
SDL_FreeSurface(PV);
SDL_FreeSurface
(
PV
);
TTF_CloseFont
(
vieille_police
);
TTF_CloseFont
(
vieille_police
);
etat
=
FERMER
;
etat
=
FERMER
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment