Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MLOD_ProjectC
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Erwan MERLY
MLOD_ProjectC
Commits
8badac28
Commit
8badac28
authored
Oct 31, 2020
by
Erwan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ajout des controles et des regles à l'interface
parent
2f69a3df
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
6 deletions
+21
-6
minesweeper.c
minesweeper.c
+21
-6
No files found.
minesweeper.c
View file @
8badac28
...
...
@@ -162,7 +162,6 @@ int main(void)
//--------------------------------------------------------------------------------------
const
int
screenWidth
=
1280
;
const
int
screenHeight
=
800
;
int
fontSizeBig
=
screenWidth
*
screenHeight
/
30000
;
int
fontSizeSmall
=
screenWidth
*
screenHeight
/
35000
;
InitWindow
(
screenWidth
,
screenHeight
,
"HexaSweeper - Erwan MERLY"
);
SetTargetFPS
(
60
);
...
...
@@ -267,22 +266,38 @@ int main(void)
//AFFICHAGE DE L'INTERFACE
DrawRectangle
(
0
,
screenHeight
-
75
,
screenWidth
,
75
,
Fade
(
LIGHTGRAY
,
0
.
5
f
));
DrawText
(
TextFormat
(
"MINE FLAGGED: %d/%d"
,
flaggedMines
,
nbMines
),
50
,
screenHeight
-
50
,
fontSizeBig
,
GRAY
);
DrawText
(
TextFormat
(
"Time: %d s"
,
(
int
)
timeEllapsed
),
screenWidth
-
250
,
screenHeight
-
50
,
fontSizeBig
,
GRAY
);
DrawText
(
TextFormat
(
"MINE FLAGGED: %d/%d"
,
flaggedMines
,
nbMines
),
50
,
screenHeight
-
50
,
35
,
GRAY
);
DrawText
(
TextFormat
(
"Time: %d s"
,
(
int
)
timeEllapsed
),
screenWidth
-
250
,
screenHeight
-
50
,
35
,
GRAY
);
//AFFICHAGE CONTROLES ET REGLES
DrawText
(
"CONTROLS"
,
screenWidth
-
275
,
50
,
35
,
DARKGRAY
);
DrawText
(
"LEFT CLICK - REVEAL TILE"
,
screenWidth
-
350
,
100
,
18
,
LIGHTGRAY
);
DrawText
(
"RIGHT CLICK - FLAG TILE"
,
screenWidth
-
350
,
130
,
18
,
LIGHTGRAY
);
DrawText
(
"MIDDLE CLICK - REVEAL NEIGHBOURS"
,
screenWidth
-
350
,
160
,
18
,
LIGHTGRAY
);
DrawText
(
"RULES"
,
screenWidth
-
275
,
210
,
35
,
DARKGRAY
);
DrawText
(
"NUMBER INDICATE MINES AROUND"
,
screenWidth
-
350
,
260
,
18
,
LIGHTGRAY
);
DrawText
(
"FLAG ALL THE MINES TO WIN"
,
screenWidth
-
350
,
290
,
18
,
LIGHTGRAY
);
DrawText
(
"TILES"
,
screenWidth
-
275
,
340
,
35
,
DARKGRAY
);
DrawText
(
"DARK GRAY - NON REVEALED"
,
screenWidth
-
350
,
390
,
18
,
LIGHTGRAY
);
DrawText
(
"LIGHT GRAY - REVEALED"
,
screenWidth
-
350
,
420
,
18
,
LIGHTGRAY
);
DrawText
(
"GREEN - FLAGGED"
,
screenWidth
-
350
,
450
,
18
,
LIGHTGRAY
);
DrawText
(
"RED - MINE"
,
screenWidth
-
350
,
480
,
18
,
LIGHTGRAY
);
//AFFICHAGE FIN DE PARTIE
if
(
lose
||
win
){
DrawRectangle
(
0
,
screenHeight
*
0
.
55
,
screenWidth
,
screenHeight
/
8
,
Fade
(
GRAY
,
0
.
8
f
));
if
(
lose
){
DrawText
(
"GAME OVER"
,
screenWidth
/
2
-
strlen
(
"GAME OVER"
)
/
2
*
fontSizeBig
,
screenHeight
*
0
.
58
,
fontSizeBig
,
MAROON
);
DrawText
(
"GAME OVER"
,
screenWidth
/
2
-
strlen
(
"GAME OVER"
)
/
2
*
35
,
screenHeight
*
0
.
58
,
35
,
MAROON
);
for
(
int
i
=
0
;
i
<
nbLigneMatrice
;
i
++
){
for
(
int
j
=
0
;
j
<
nbColonneMatrice
;
j
++
){
if
(
containsMine
(
i
,
j
,
matriceMines
))
revelerCase
(
matriceMines
,
i
,
j
,
nbLigneMatrice
,
nbColonneMatrice
);
}
}
}
if
(
win
)
DrawText
(
"YOU WIN!"
,
screenWidth
/
2
-
strlen
(
"YOU WIN!"
)
/
2
*
fontSizeBig
,
screenHeight
*
0
.
57
,
fontSizeBig
,
LIME
);
DrawText
(
"PRESS R TO REPLAY"
,
screenWidth
/
2
-
strlen
(
"PRESS R TO REPLAY"
)
/
2
*
fontSizeSmall
,
screenHeight
*
0
.
62
,
fontSizeSmall
,
DARKGRAY
);
if
(
win
)
DrawText
(
"YOU WIN!"
,
screenWidth
/
2
-
strlen
(
"YOU WIN!"
)
/
2
*
35
,
screenHeight
*
0
.
57
,
35
,
LIME
);
DrawText
(
"PRESS R TO REPLAY"
,
screenWidth
/
2
-
strlen
(
"PRESS R TO REPLAY"
)
/
2
*
30
,
screenHeight
*
0
.
62
,
30
,
DARKGRAY
);
}
EndDrawing
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment