added option for clearing out the grid
This commit is contained in:
parent
71fc46f9ab
commit
24dd2ed5a7
6
gol.c
6
gol.c
@ -95,7 +95,7 @@ void draw_grid(bool grid[SIZE][SIZE], int cellw, int cellh, bool gamestate){
|
|||||||
if(gamestate == false){
|
if(gamestate == false){
|
||||||
DrawRectangle((GetMouseX()/cellw)*cellw, (GetMouseY()/cellh)*cellh, cellw, cellh, WHITE);
|
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();
|
EndDrawing();
|
||||||
}
|
}
|
||||||
@ -130,6 +130,10 @@ int main()
|
|||||||
grid[GetMouseX()/10][GetMouseY()/10] = false;
|
grid[GetMouseX()/10][GetMouseY()/10] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(IsKeyPressed(KEY_C)){
|
||||||
|
initialize_grid(grid);
|
||||||
|
}
|
||||||
|
|
||||||
draw_grid(grid, cellw, cellh, gamestate);
|
draw_grid(grid, cellw, cellh, gamestate);
|
||||||
mirror_grid(grid, mirror);
|
mirror_grid(grid, mirror);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user