added option for clearing out the grid

This commit is contained in:
Marcelina Szostak 2025-07-01 14:31:23 +02:00
parent 71fc46f9ab
commit 24dd2ed5a7
Signed by: kapcioszek
GPG Key ID: 5B07EB46181A963B

6
gol.c
View File

@ -95,7 +95,7 @@ void draw_grid(bool grid[SIZE][SIZE], int cellw, int cellh, bool gamestate){
if(gamestate == false){
DrawRectangle((GetMouseX()/cellw)*cellw, (GetMouseY()/cellh)*cellh, cellw, cellh, WHITE);
DrawText("LMB: Draw, RMB: Erase, Space: Start/Stop the game, ESC: Exit", WIDTH*0.15, HEIGHT*0.9, 20, WHITE);
DrawText("LMB: Draw, RMB: Erase, C: Clear the screen, Space: Start/Stop the game, ESC: Exit", WIDTH*0.05, HEIGHT*0.9, 20, WHITE);
}
EndDrawing();
}
@ -130,6 +130,10 @@ int main()
grid[GetMouseX()/10][GetMouseY()/10] = false;
}
if(IsKeyPressed(KEY_C)){
initialize_grid(grid);
}
draw_grid(grid, cellw, cellh, gamestate);
mirror_grid(grid, mirror);
}