breakout - How do I get the initBricks function to accept floats for better precision when placing bricks? -
breakout - How do I get the initBricks function to accept floats for better precision when placing bricks? -
i'm trying precise positioning of bricks when using initbricks. not placing should 9out little fractions) , i'm pretty because code using ints i'm trying utilize floats. or perhaps prototype accepts ints, in case, how can bricks spaced given have have 10 rows , space between bricks?
/** * initializes window grid of bricks. */ void initbricks(gwindow window) { float brickwidth = width / (cols + 1); float brickheight = height / (3*rows); float brickspace = width / (20*(rows + 1)); (int j = 0; j < rows; j++) { (int = 0; < 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); } } }
breakout
Comments
Post a Comment