Loading...
Logo
Processing Forum
If I have a grid of squares that is suppose to show 28 squares and the gridSize is based on the nearest square how to I write the code to make it draw 28 squares in a 5x5 or say 10 squares in a 3x3?

Replies(1)

Calculate the grid dimensions with int( sqrt( numSquares ) )

Then calculate the cell width/height and use a double for loop to draw the grid.