Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MLOD Mini Projet
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
Yoann Bordin
MLOD Mini Projet
Commits
95aa3d4d
Commit
95aa3d4d
authored
4 years ago
by
Yoann Bordin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added level gestion
parent
f3c8496d
master
dev
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
19 deletions
+8
-19
tetris-graph.c
tetris-graph.c
+5
-0
tetris-graph.h
tetris-graph.h
+1
-0
tetris-main.c
tetris-main.c
+1
-14
tetris-main.exe
tetris-main.exe
+0
-0
tetris-struct.c
tetris-struct.c
+1
-5
No files found.
tetris-graph.c
View file @
95aa3d4d
...
@@ -45,6 +45,11 @@ void displayScore(int score){
...
@@ -45,6 +45,11 @@ void displayScore(int score){
DrawText
(
TextFormat
(
"%4i"
,
score
),
430
,
80
,
20
,
RAYWHITE
);
DrawText
(
TextFormat
(
"%4i"
,
score
),
430
,
80
,
20
,
RAYWHITE
);
}
}
void
displayLevel
(
int
level
){
DrawText
(
"level"
,
400
,
120
,
20
,
RAYWHITE
);
DrawText
(
TextFormat
(
"%4i"
,
level
),
430
,
150
,
20
,
RAYWHITE
);
}
void
displaySquare
(
Square
sq
,
int
pIndex
,
int
pListIndex
){
void
displaySquare
(
Square
sq
,
int
pIndex
,
int
pListIndex
){
char
text0
[
5
];
char
text0
[
5
];
char
text1
[
5
];
char
text1
[
5
];
...
...
This diff is collapsed.
Click to expand it.
tetris-graph.h
View file @
95aa3d4d
...
@@ -20,6 +20,7 @@ void drawGrid(Grid g);
...
@@ -20,6 +20,7 @@ void drawGrid(Grid g);
// Display functions
// Display functions
void
displayScore
(
int
score
);
void
displayScore
(
int
score
);
void
displayLevel
(
int
level
);
// Display functions (debug only)
// Display functions (debug only)
void
displaySquare
(
Square
sq
,
int
pIndex
,
int
pListIndex
);
void
displaySquare
(
Square
sq
,
int
pIndex
,
int
pListIndex
);
...
...
This diff is collapsed.
Click to expand it.
tetris-main.c
View file @
95aa3d4d
...
@@ -19,19 +19,7 @@ int main(void){
...
@@ -19,19 +19,7 @@ int main(void){
BeginDrawing
();
BeginDrawing
();
InitDisplay
();
InitDisplay
();
displayScore
(
score
);
displayScore
(
score
);
displayLevel
(
level
);
// Testing
char
text1
[
10
];
itoa
(
grid
.
height
,
text1
,
10
);
DrawText
(
text1
,
20
,
20
,
20
,
RED
);
char
text2
[
5
];
itoa
(
height
(
grid
),
text2
,
10
);
DrawText
(
text2
,
50
,
20
,
20
,
RED
);
if
(
!
gameOver
(
grid
)){
DrawText
(
"not game over"
,
100
,
20
,
20
,
RED
);
}
// Nouvelles pièces
// Nouvelles pièces
if
(
isFixed
){
if
(
isFixed
){
...
@@ -101,7 +89,6 @@ int main(void){
...
@@ -101,7 +89,6 @@ int main(void){
drawPiece
(
p
);
drawPiece
(
p
);
drawGrid
(
grid
);
drawGrid
(
grid
);
displayGrid
(
grid
);
frameCounter
++
;
frameCounter
++
;
...
...
This diff is collapsed.
Click to expand it.
tetris-main.exe
View file @
95aa3d4d
No preview for this file type
This diff is collapsed.
Click to expand it.
tetris-struct.c
View file @
95aa3d4d
...
@@ -80,7 +80,6 @@ Square getSquare(char* line, int index){
...
@@ -80,7 +80,6 @@ Square getSquare(char* line, int index){
Piece
getPieceFromLine
(
char
*
line
){
Piece
getPieceFromLine
(
char
*
line
){
Piece
p
=
pieceInit
();
Piece
p
=
pieceInit
();
Square
sq
;
Square
sq
;
DrawText
(
line
,
50
,
50
,
20
,
RAYWHITE
);
for
(
int
i
=
0
;
i
<
p
.
size
;
i
++
){
for
(
int
i
=
0
;
i
<
p
.
size
;
i
++
){
sq
=
getSquare
(
line
,
i
);
sq
=
getSquare
(
line
,
i
);
...
@@ -146,7 +145,7 @@ bool canMoveVert(Grid g, Piece p, int moveNum){
...
@@ -146,7 +145,7 @@ bool canMoveVert(Grid g, Piece p, int moveNum){
int
x
=
p
.
squares
[
i
]
->
posX
;
int
x
=
p
.
squares
[
i
]
->
posX
;
int
y
=
p
.
squares
[
i
]
->
posY
+
moveNum
;
int
y
=
p
.
squares
[
i
]
->
posY
+
moveNum
;
if
(
y
>=
g
.
height
||
g
.
grid
[
x
][
y
]
!=
NULL
){
if
(
y
<
0
||
y
>=
g
.
height
||
g
.
grid
[
x
][
y
]
!=
NULL
){
return
false
;
return
false
;
}
}
}
}
...
@@ -173,9 +172,6 @@ void movePieceVert(Piece piece, int shift){
...
@@ -173,9 +172,6 @@ void movePieceVert(Piece piece, int shift){
for
(
int
i
=
0
;
i
<
piece
.
size
;
i
++
){
for
(
int
i
=
0
;
i
<
piece
.
size
;
i
++
){
moveSquareVert
(
piece
.
squares
[
i
],
shift
);
moveSquareVert
(
piece
.
squares
[
i
],
shift
);
}
}
char
text3
[
5
];
itoa
(
shift
,
text3
,
20
);
DrawText
(
text3
,
450
,
20
,
20
,
RED
);
}
}
void
moveSquareHztl
(
Square
sq
,
int
shift
){
void
moveSquareHztl
(
Square
sq
,
int
shift
){
...
...
This diff is collapsed.
Click to expand it.
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