Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
ProjetZZ1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
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
Marc BERET
ProjetZZ1
Commits
693a9ac1
Commit
693a9ac1
authored
2 years ago
by
antoinemeyer5
Browse files
Options
Downloads
Patches
Plain Diff
dessin du moulin
parent
7b3ad809
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
travail_individuel/Meyer/pave_de_serpents/main
+0
-0
0 additions, 0 deletions
travail_individuel/Meyer/pave_de_serpents/main
travail_individuel/Meyer/pave_de_serpents/main.c
+79
-6
79 additions, 6 deletions
travail_individuel/Meyer/pave_de_serpents/main.c
with
79 additions
and
6 deletions
travail_individuel/Meyer/pave_de_serpents/main
+
0
−
0
View file @
693a9ac1
No preview for this file type
This diff is collapsed.
Click to expand it.
travail_individuel/Meyer/pave_de_serpents/main.c
+
79
−
6
View file @
693a9ac1
...
...
@@ -7,6 +7,8 @@ int main(int argc, char **argv)
(
void
)
argc
;
(
void
)
argv
;
int
vainqueur
=
0
;
SDL_Window
*
window
=
NULL
;
...
...
@@ -20,6 +22,12 @@ int main(int argc, char **argv)
int
display_width
;
int
display_height
;
SDL_Renderer
*
renderer
;
SDL_Rect
rect
;
int
pale_1_x
;
int
pale_1_y
;
if
(
SDL_GetDesktopDisplayMode
(
0
,
&
mode
)
!=
0
)
{
SDL_Log
(
"SDL_GetDesktopDisplayMode failed: %s"
,
SDL_GetError
());
...
...
@@ -40,7 +48,7 @@ int main(int argc, char **argv)
window_x
=
(
display_width
-
window_width
)
/
2
;
window_y
=
(
display_height
-
window_height
)
/
2
;
window
=
SDL_CreateWindow
(
"
C
ou
rse de forme
s"
,
"
M
ou
lin à serpent
s"
,
window_x
,
window_y
,
// centrage de la fenêtre
window_width
,
window_height
,
// largeur, hauteur
SDL_WINDOW_RESIZABLE
);
// redimensionnable
...
...
@@ -53,13 +61,78 @@ int main(int argc, char **argv)
exit
(
EXIT_FAILURE
);
}
// decompte decollage
SDL_Delay
(
1000
);
SDL_SetWindowTitle
(
window
,
"Rocket : 2"
);
renderer
=
SDL_CreateRenderer
(
window
,
-
1
,
SDL_RENDERER_ACCELERATED
);
/* SDL_RENDERER_SOFTWARE */
if
(
renderer
==
0
)
{
fprintf
(
stderr
,
"Erreur d'initialisation de la SDL : %s
\n
"
,
SDL_GetError
());
SDL_Quit
();
// On referme la SDL
exit
(
EXIT_FAILURE
);
}
// dessin
/* couleur de fond */
SDL_SetRenderDrawColor
(
renderer
,
157
,
224
,
144
,
255
);
SDL_RenderClear
(
renderer
);
//sol
SDL_SetRenderDrawColor
(
renderer
,
49
,
150
,
29
,
255
);
rect
.
w
=
window_width
;
rect
.
h
=
window_height
/
3
;
rect
.
x
=
0
;
rect
.
y
=
window_height
-
window_height
/
3
;
SDL_RenderFillRect
(
renderer
,
&
rect
);
/* bloc du moulin */
SDL_SetRenderDrawColor
(
renderer
,
255
,
255
,
255
,
255
);
rect
.
w
=
150
;
rect
.
h
=
250
;
rect
.
x
=
(
window_width
-
rect
.
w
)
/
2
;
rect
.
y
=
window_height
-
rect
.
h
-
150
;
SDL_RenderFillRect
(
renderer
,
&
rect
);
/*triangle moulin*/
SDL_SetRenderDrawColor
(
renderer
,
255
,
0
,
0
,
255
);
rect
.
w
=
150
;
rect
.
h
=
50
;
rect
.
x
=
(
window_width
-
rect
.
w
)
/
2
;
rect
.
y
=
window_height
-
rect
.
h
-
400
;
SDL_RenderFillRect
(
renderer
,
&
rect
);
//pales du moulin
//pale 1 du moulin
pale_1_x
=
50
;
pale_1_y
=
50
;
SDL_SetRenderDrawColor
(
renderer
,
163
,
82
,
2
,
255
);
SDL_RenderDrawLine
(
renderer
,
(
window_width
-
rect
.
w
)
/
2
,
window_height
-
rect
.
h
-
400
,
pale_1_x
,
pale_1_y
);
/* afficher à l'ecran */
SDL_RenderPresent
(
renderer
);
// départ de la course
/*while (vainqueur == 0)
{
if (cercle.x > display_width)
{
vainqueur = 1;
}
}*/
// ecrire victoire
//actualise la bete
SDL_Delay
(
2000
);
//
explosion de la rocket
//
fermer fenetre
SDL_DestroyWindow
(
window
);
// la fenêtre
SDL_Quit
();
// la SDL
...
...
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