i'm trying to be very precise with the positioning of my bricks when using initBricks. however they are not placing exactly where they should be 9out by small fractions) and i'm pretty certain it is because my code is using ints where i'm trying to get it to use floats. or perhaps the prototype only accepts ints, in which case, how can i get my bricks to be properly spaced given i have to have 10 ROWS and space between the bricks?
/**
* Initializes window with a grid of bricks.
*/
void initBricks(GWindow window)
{
float brickWidth = WIDTH / (COLS + 1);
float brickHeight = HEIGHT / (3*ROWS);
float brickSpace = WIDTH / (20*(ROWS + 1));
for (int j = 0; j < ROWS; j++)
{
for (int i = 0; i < COLS; i++)
{
GRect brick = newGRect(i*brickWidth + i*brickSpace + brickSpace, j*brickHeight + j*brickSpace + brickSpace,
brickWidth, brickHeight);
setColor(brick, "RED");
setFilled(brick, true);
add(window, brick);
}
}
}