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
551d3be6
There was a problem fetching the pipeline summary.
Commit
551d3be6
authored
8 years ago
by
Montjoie Henri
Browse files
Options
Downloads
Patches
Plain Diff
affichage du nom des joueurs dans l'ecran de selection
parent
4e563512
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/SDL_bis.c
+49
-9
49 additions, 9 deletions
src/SDL_bis.c
with
49 additions
and
9 deletions
src/SDL_bis.c
+
49
−
9
View file @
551d3be6
...
@@ -9,16 +9,21 @@
...
@@ -9,16 +9,21 @@
int
SDL_bis
()
int
SDL_bis
()
{
int
quitter
=
0
;
{
EtatsJeu
etat
=
SAISIE_JOUEURS
;
EtatsJeu
etat
=
SAISIE_JOUEURS
;
SDL_Surface
*
ecran
=
NULL
;
SDL_Surface
*
ecran
=
NULL
;
SDL_Event
event
;
SDL_Event
event
;
SDL_Surface
*
logo
=
NULL
;
SDL_Surface
*
logo
=
NULL
;
SDL_Surface
*
rectangle
=
NULL
;
SDL_Surface
*
rectangle
=
NULL
;
SDL_Surface
*
texte
=
NULL
;
SDL_Surface
*
texte
=
NULL
;
SDL_Surface
*
texte2
=
NULL
;
SDL_Surface
*
texte3
=
NULL
;
SDL_Rect
pos_logo
;
SDL_Rect
pos_logo
;
SDL_Rect
pos_texte
;
SDL_Rect
pos_texte
;
SDL_Rect
pos_texte2
;
SDL_Rect
pos_texte3
;
SDL_Rect
pos_texte3_bis
;
TTF_Font
*
police
=
NULL
;
TTF_Font
*
police
=
NULL
;
TTF_Font
*
petite_police
=
NULL
;
if
(
SDL_Init
(
SDL_INIT_VIDEO
)
<
0
)
if
(
SDL_Init
(
SDL_INIT_VIDEO
)
<
0
)
{
{
...
@@ -57,7 +62,7 @@ int SDL_bis()
...
@@ -57,7 +62,7 @@ int SDL_bis()
printf
(
"Unable to load bitmap: %s
\n
"
,
SDL_GetError
());
printf
(
"Unable to load bitmap: %s
\n
"
,
SDL_GetError
());
return
1
;
return
1
;
}
}
pos_logo
.
x
=
0
;
pos_logo
.
x
=
(
ecran
->
w
-
logo
->
w
)
/
2
;
pos_logo
.
y
=
0
;
pos_logo
.
y
=
0
;
pos_texte
.
x
=
(
ecran
->
w
-
texte
->
w
)
/
2
;
pos_texte
.
x
=
(
ecran
->
w
-
texte
->
w
)
/
2
;
pos_texte
.
y
=
ecran
->
h
-
200
;
pos_texte
.
y
=
ecran
->
h
-
200
;
...
@@ -67,17 +72,25 @@ int SDL_bis()
...
@@ -67,17 +72,25 @@ int SDL_bis()
char
nom_joueur1
[
TAILLE_NOMS
]
=
""
;
char
nom_joueur1
[
TAILLE_NOMS
]
=
""
;
fgets
(
nom_joueur1
,
sizeof
(
nom_joueur1
),
stdin
);
fgets
(
nom_joueur1
,
sizeof
(
nom_joueur1
),
stdin
);
if
(
strlen
(
nom_joueur1
)
>
TAILLE_NOMS
-
2
){
printf
(
"erreur : nom trop long"
);
return
-
1
;
}
nom_joueur1
[
strlen
(
nom_joueur1
)
-
1
]
=
NULL
;
char
nom_joueur2
[
15
]
=
""
;
char
nom_joueur2
[
TAILLE_NOMS
]
=
""
;
// ajouter_joueurs(nom_joueur1,nom_joueur2, &etat); //a coder par colin
texte
=
TTF_RenderText_Shaded
(
police
,
"Entrez le nom du joueur 2"
,
couleurBlanche
,
couleurNoire
);
texte
=
TTF_RenderText_Shaded
(
police
,
"Entrez le nom du joueur 2"
,
couleurBlanche
,
couleurNoire
);
SDL_BlitSurface
(
texte
,
NULL
,
ecran
,
&
pos_texte
);
SDL_BlitSurface
(
texte
,
NULL
,
ecran
,
&
pos_texte
);
SDL_Flip
(
ecran
);
SDL_Flip
(
ecran
);
//char nom_joueur2[TAILLE_NOMS] = "";
fgets
(
nom_joueur2
,
sizeof
(
nom_joueur2
),
stdin
);
fgets
(
nom_joueur2
,
sizeof
(
nom_joueur2
),
stdin
);
if
(
strlen
(
nom_joueur1
)
>
TAILLE_NOMS
-
2
){
printf
(
"erreur : nom trop long"
);
return
-
1
;
}
nom_joueur2
[
strlen
(
nom_joueur2
)
-
1
]
=
NULL
;
ajouterUnJoueur
(
nom_joueur1
,
&
etat
);
ajouterUnJoueur
(
nom_joueur1
,
&
etat
);
ajouterUnJoueur
(
nom_joueur2
,
&
etat
);
ajouterUnJoueur
(
nom_joueur2
,
&
etat
);
...
@@ -115,6 +128,31 @@ int SDL_bis()
...
@@ -115,6 +128,31 @@ int SDL_bis()
SDL_Flip
(
ecran
);
SDL_Flip
(
ecran
);
}
}
SDL_FillRect
(
ecran
,
NULL
,
SDL_MapRGB
(
ecran
->
format
,
0
,
0
,
0
));
SDL_Flip
(
ecran
);
police
=
TTF_OpenFont
(
"../resources/fonts/OLDENGL.ttf"
,
44
);
petite_police
=
TTF_OpenFont
(
"../resources/fonts/OLDENGL.ttf"
,
32
);
texte
=
TTF_RenderText_Shaded
(
police
,
nom_joueur1
,
couleurBlanche
,
couleurNoire
);
texte2
=
TTF_RenderText_Shaded
(
police
,
nom_joueur2
,
couleurBlanche
,
couleurNoire
);
texte3
=
TTF_RenderText_Shaded
(
petite_police
,
"choisissez vos personnages"
,
couleurBlanche
,
couleurNoire
);
pos_texte
.
x
=
ecran
->
w
/
4
-
texte
->
w
/
2
;
pos_texte
.
y
=
10
;
pos_texte2
.
x
=
(
3
*
ecran
->
w
)
/
4
-
texte2
->
w
/
2
;
pos_texte2
.
y
=
10
;
pos_texte3
.
x
=
pos_texte
.
x
-
(
texte3
->
w
-
texte
->
w
)
/
2
;
pos_texte3
.
y
=
pos_texte
.
y
+
(
3
*
texte3
->
h
)
/
2
;
pos_texte3_bis
.
x
=
pos_texte2
.
x
-
(
texte3
->
w
-
texte2
->
w
)
/
2
;
pos_texte3_bis
.
y
=
pos_texte2
.
y
+
(
3
*
texte3
->
h
)
/
2
;
SDL_BlitSurface
(
texte
,
NULL
,
ecran
,
&
pos_texte
);
SDL_BlitSurface
(
texte2
,
NULL
,
ecran
,
&
pos_texte2
);
SDL_BlitSurface
(
texte3
,
NULL
,
ecran
,
&
pos_texte3
);
SDL_BlitSurface
(
texte3
,
NULL
,
ecran
,
&
pos_texte3_bis
);
SDL_Flip
(
ecran
);
while
(
etat
==
CONFIGURATION
)
while
(
etat
==
CONFIGURATION
)
{
{
SDL_WaitEvent
(
&
event
);
SDL_WaitEvent
(
&
event
);
...
@@ -122,13 +160,15 @@ int SDL_bis()
...
@@ -122,13 +160,15 @@ int SDL_bis()
{
{
case
SDL_QUIT
:
case
SDL_QUIT
:
etat
=
FERMER
;
etat
=
FERMER
;
break
;
break
;
/*
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONDOWN:
if (event.button.x<pos_texte.x+texte->w&&event.button.x>pos_texte.x&&event.button.y<pos_texte.y+texte->h&&event.button.y>pos_texte.y)
if (event.button.x<pos_texte.x+texte->w&&event.button.x>pos_texte.x&&event.button.y<pos_texte.y+texte->h&&event.button.y>pos_texte.y)
etat=CONFIGURATION;
etat=CONFIGURATION;
break;
break;
}
}
SDL_BlitSurface(texte,NULL,ecran,&pos_texte);*/
SDL_Flip
(
ecran
);
}
}
}
return
0
;
return
0
;
}
}
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