From 24dd2ed5a7032cfe12f6e6276416de39c02a152b Mon Sep 17 00:00:00 2001 From: Marcelina Szostak Date: Tue, 1 Jul 2025 14:31:23 +0200 Subject: [PATCH] added option for clearing out the grid --- gol.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gol.c b/gol.c index a501179..0d8932b 100644 --- a/gol.c +++ b/gol.c @@ -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); }