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
Show 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;
// Music variables
Music
soundtrack
;
Sound
losing
;
Sound
fading
;
//------------------------------------------------------------------------------------
// Program main entry point
...
...
@@ -122,9 +124,14 @@ int main(void)
//---------------------------------------------------------
InitWindow
(
screenWidth
,
screenHeight
,
"tetris - revamped"
);
// Initializing sound system
InitAudioDevice
();
char
*
filename
=
"tetris-soundtrack.mp3"
;
soundtrack
=
LoadMusicStream
(
filename
);
char
*
music
=
"tetris-soundtrack.mp3"
;
char
*
fade
=
"fading-sound.mp3"
;
char
*
lose
=
"losing-sound.mp3"
;
soundtrack
=
LoadMusicStream
(
music
);
fading
=
LoadSound
(
fade
);
losing
=
LoadSound
(
lose
);
PlayMusicStream
(
soundtrack
);
InitGame
();
...
...
@@ -301,6 +308,7 @@ void UpdateGame(void)
{
// Animation when deleting lines
fadeLineCounter
++
;
PlaySound
(
fading
);
if
(
fadeLineCounter
%
8
<
4
)
fadingColor
=
MAROON
;
else
fadingColor
=
GRAY
;
...
...
@@ -320,10 +328,14 @@ void UpdateGame(void)
}
else
{
StopMusicStream
(
soundtrack
);
PlaySound
(
losing
);
if
(
IsKeyPressed
(
KEY_ENTER
))
{
InitGame
();
gameOver
=
false
;
StopSound
(
losing
);
PlayMusicStream
(
soundtrack
);
}
}
}
...
...
@@ -415,8 +427,8 @@ void DrawGame(void)
}
DrawText
(
"INCOMING:"
,
offset
.
x
,
offset
.
y
-
100
,
10
,
GRAY
);
DrawText
(
TextFormat
(
"LINES: %04i"
,
lines
),
offset
.
x
,
offset
.
y
+
20
,
1
0
,
GRAY
);
DrawText
(
TextFormat
(
"SCORE: %04i"
,
score
),
offset
.
x
,
offset
.
y
+
30
,
10
,
RED
);
DrawText
(
TextFormat
(
"LINES: %04i"
,
lines
),
offset
.
x
,
offset
.
y
+
20
,
1
5
,
GRAY
);
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
);
}
...
...
@@ -433,6 +445,8 @@ void DrawGame(void)
void
UnloadGame
(
void
)
{
UnloadMusicStream
(
soundtrack
);
UnloadSound
(
fading
);
UnloadSound
(
losing
);
}
// 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