Commit 95aa3d4d authored by Yoann Bordin's avatar Yoann Bordin

Added level gestion

parent f3c8496d
...@@ -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];
......
...@@ -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);
......
...@@ -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++;
......
No preview for this file type
...@@ -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){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment