Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
Mini-Projet-TETRIS
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
DIDON Maya
Mini-Projet-TETRIS
Commits
b0272bc9
Commit
b0272bc9
authored
Oct 30, 2020
by
DIDON Maya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ajout d'effets sonores
parent
ed9c6bb2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
4 deletions
+18
-4
fading-sound.mp3
fading-sound.mp3
+0
-0
losing-sound.mp3
losing-sound.mp3
+0
-0
tetris.c
tetris.c
+18
-4
tetris.exe
tetris.exe
+0
-0
No files found.
fading-sound.mp3
0 → 100644
View file @
b0272bc9
File added
losing-sound.mp3
0 → 100644
View file @
b0272bc9
File added
tetris.c
View file @
b0272bc9
...
@@ -112,6 +112,8 @@ static int highScore = 0;
...
@@ -112,6 +112,8 @@ static int highScore = 0;
// Music variables
// Music variables
Music
soundtrack
;
Music
soundtrack
;
Sound
losing
;
Sound
fading
;
//------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------
// Program main entry point
// Program main entry point
...
@@ -122,9 +124,14 @@ int main(void)
...
@@ -122,9 +124,14 @@ int main(void)
//---------------------------------------------------------
//---------------------------------------------------------
InitWindow
(
screenWidth
,
screenHeight
,
"tetris - revamped"
);
InitWindow
(
screenWidth
,
screenHeight
,
"tetris - revamped"
);
// Initializing sound system
InitAudioDevice
();
InitAudioDevice
();
char
*
filename
=
"tetris-soundtrack.mp3"
;
char
*
music
=
"tetris-soundtrack.mp3"
;
soundtrack
=
LoadMusicStream
(
filename
);
char
*
fade
=
"fading-sound.mp3"
;
char
*
lose
=
"losing-sound.mp3"
;
soundtrack
=
LoadMusicStream
(
music
);
fading
=
LoadSound
(
fade
);
losing
=
LoadSound
(
lose
);
PlayMusicStream
(
soundtrack
);
PlayMusicStream
(
soundtrack
);
InitGame
();
InitGame
();
...
@@ -301,6 +308,7 @@ void UpdateGame(void)
...
@@ -301,6 +308,7 @@ void UpdateGame(void)
{
{
// Animation when deleting lines
// Animation when deleting lines
fadeLineCounter
++
;
fadeLineCounter
++
;
PlaySound
(
fading
);
if
(
fadeLineCounter
%
8
<
4
)
fadingColor
=
MAROON
;
if
(
fadeLineCounter
%
8
<
4
)
fadingColor
=
MAROON
;
else
fadingColor
=
GRAY
;
else
fadingColor
=
GRAY
;
...
@@ -320,10 +328,14 @@ void UpdateGame(void)
...
@@ -320,10 +328,14 @@ void UpdateGame(void)
}
}
else
else
{
{
StopMusicStream
(
soundtrack
);
PlaySound
(
losing
);
if
(
IsKeyPressed
(
KEY_ENTER
))
if
(
IsKeyPressed
(
KEY_ENTER
))
{
{
InitGame
();
InitGame
();
gameOver
=
false
;
gameOver
=
false
;
StopSound
(
losing
);
PlayMusicStream
(
soundtrack
);
}
}
}
}
}
}
...
@@ -415,8 +427,8 @@ void DrawGame(void)
...
@@ -415,8 +427,8 @@ void DrawGame(void)
}
}
DrawText
(
"INCOMING:"
,
offset
.
x
,
offset
.
y
-
100
,
10
,
GRAY
);
DrawText
(
"INCOMING:"
,
offset
.
x
,
offset
.
y
-
100
,
10
,
GRAY
);
DrawText
(
TextFormat
(
"LINES: %04i"
,
lines
),
offset
.
x
,
offset
.
y
+
20
,
1
0
,
GRAY
);
DrawText
(
TextFormat
(
"LINES: %04i"
,
lines
),
offset
.
x
,
offset
.
y
+
20
,
1
5
,
GRAY
);
DrawText
(
TextFormat
(
"SCORE: %04i"
,
score
),
offset
.
x
,
offset
.
y
+
30
,
10
,
RED
);
DrawText
(
TextFormat
(
"SCORE: %04i"
,
score
),
offset
.
x
,
offset
.
y
+
50
,
15
,
RED
);
if
(
pause
)
DrawText
(
"GAME PAUSED"
,
screenWidth
/
2
-
MeasureText
(
"GAME PAUSED"
,
40
)
/
2
,
screenHeight
/
2
-
40
,
40
,
GRAY
);
if
(
pause
)
DrawText
(
"GAME PAUSED"
,
screenWidth
/
2
-
MeasureText
(
"GAME PAUSED"
,
40
)
/
2
,
screenHeight
/
2
-
40
,
40
,
GRAY
);
}
}
...
@@ -433,6 +445,8 @@ void DrawGame(void)
...
@@ -433,6 +445,8 @@ void DrawGame(void)
void
UnloadGame
(
void
)
void
UnloadGame
(
void
)
{
{
UnloadMusicStream
(
soundtrack
);
UnloadMusicStream
(
soundtrack
);
UnloadSound
(
fading
);
UnloadSound
(
losing
);
}
}
// Update and Draw (one frame)
// Update and Draw (one frame)
...
...
tetris.exe
View file @
b0272bc9
No preview for this file type
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