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
ed9c6bb2
Commit
ed9c6bb2
authored
Oct 30, 2020
by
DIDON Maya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ajout de musique de fond
parent
013caf42
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
14 deletions
+25
-14
README.md
README.md
+2
-1
high-score.txt
high-score.txt
+1
-1
tetris-soundtrack.mp3
tetris-soundtrack.mp3
+0
-0
tetris.c
tetris.c
+22
-12
tetris.exe
tetris.exe
+0
-0
No files found.
README.md
View file @
ed9c6bb2
...
@@ -6,4 +6,5 @@ Les améliorations majeures proposées sont :
...
@@ -6,4 +6,5 @@ Les améliorations majeures proposées sont :
*
coloration des blocs
*
coloration des blocs
*
ajout d'une musique de fond
*
ajout d'une musique de fond
*
ajout de bruitages
*
ajout de bruitages
*
possibilité de gagner un bonus qui met le jeu en pause 5 secondes
*
possibilité de gagner un bonus qui met le jeu en pause 5 secondes
\ No newline at end of file
*
ajout d'une fonctionnalité score ainsi que l'affichage du meilleur score enregistré
\ No newline at end of file
high-score.txt
View file @
ed9c6bb2
9
63443
\ No newline at end of file
\ No newline at end of file
tetris-soundtrack.mp3
0 → 100644
View file @
ed9c6bb2
File added
tetris.c
View file @
ed9c6bb2
...
@@ -110,6 +110,9 @@ static unsigned int ReadHighScore();
...
@@ -110,6 +110,9 @@ static unsigned int ReadHighScore();
// High score variable
// High score variable
static
int
highScore
=
0
;
static
int
highScore
=
0
;
// Music variables
Music
soundtrack
;
//------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------
// Program main entry point
// Program main entry point
//------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------
...
@@ -119,6 +122,11 @@ int main(void)
...
@@ -119,6 +122,11 @@ int main(void)
//---------------------------------------------------------
//---------------------------------------------------------
InitWindow
(
screenWidth
,
screenHeight
,
"tetris - revamped"
);
InitWindow
(
screenWidth
,
screenHeight
,
"tetris - revamped"
);
InitAudioDevice
();
char
*
filename
=
"tetris-soundtrack.mp3"
;
soundtrack
=
LoadMusicStream
(
filename
);
PlayMusicStream
(
soundtrack
);
InitGame
();
InitGame
();
#if defined(PLATFORM_WEB)
#if defined(PLATFORM_WEB)
...
@@ -133,12 +141,14 @@ int main(void)
...
@@ -133,12 +141,14 @@ int main(void)
// Update and Draw
// Update and Draw
//----------------------------------------------------------------------------------
//----------------------------------------------------------------------------------
UpdateDrawFrame
();
UpdateDrawFrame
();
UpdateMusicStream
(
soundtrack
);
//----------------------------------------------------------------------------------
//----------------------------------------------------------------------------------
}
}
#endif
#endif
// De-Initialization
// De-Initialization
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
UnloadGame
();
// Unload loaded data (textures, sounds, models...)
UnloadGame
();
// Unload loaded data (textures, sounds, models...)
CloseAudioDevice
();
CloseWindow
();
// Close window and OpenGL context
CloseWindow
();
// Close window and OpenGL context
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
...
@@ -318,17 +328,6 @@ void UpdateGame(void)
...
@@ -318,17 +328,6 @@ void UpdateGame(void)
}
}
}
}
// Reads high score in text document
static
unsigned
int
ReadHighScore
(){
char
*
filename
=
"high-score.txt"
;
FILE
*
dataFile
;
dataFile
=
fopen
(
filename
,
"r"
);
unsigned
int
highScore
;
fscanf
(
dataFile
,
"%u"
,
&
highScore
);
fclose
(
dataFile
);
return
(
highScore
);
}
// Draw game (one frame)
// Draw game (one frame)
void
DrawGame
(
void
)
void
DrawGame
(
void
)
{
{
...
@@ -433,7 +432,7 @@ void DrawGame(void)
...
@@ -433,7 +432,7 @@ void DrawGame(void)
// Unload game variables
// Unload game variables
void
UnloadGame
(
void
)
void
UnloadGame
(
void
)
{
{
// TODO: Unload all dynamic loaded data (textures, sounds, models...)
UnloadMusicStream
(
soundtrack
);
}
}
// Update and Draw (one frame)
// Update and Draw (one frame)
...
@@ -829,3 +828,14 @@ static int DeleteCompleteLines()
...
@@ -829,3 +828,14 @@ static int DeleteCompleteLines()
}
}
return
(
nbDel
);
return
(
nbDel
);
}
}
// Reads high score in text document
static
unsigned
int
ReadHighScore
(){
char
*
filename
=
"high-score.txt"
;
FILE
*
dataFile
;
dataFile
=
fopen
(
filename
,
"r"
);
unsigned
int
highScore
;
fscanf
(
dataFile
,
"%u"
,
&
highScore
);
fclose
(
dataFile
);
return
(
highScore
);
}
\ No newline at end of file
tetris.exe
View file @
ed9c6bb2
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