This is a great question because it illustrates a very common mistake.
Here is an excerpt from your code:
for (int i = 0; i < ROWS; i++)
x = 2;
for (int j = 0; i < COLS; i++)
You have a loop within a loop. The outer loop uses the variable i as an iterator while the inner loop uses j. However, the inner loop is also (...
You don't really need to have an array to store bricks. Once you create and add a brick to the window, it stays there until you remove it using the function named removeGWindow() from the SPL library passing to it a reference to that brick after you get that reference returned by detectCollisio().
I guess the error you're getting is because you're declaring ...
It looks like your intent is to create the bricks by rows, meaning that you are creating each row with the inner loop and switching to the next row with the outer loop. However, you are incrementing the y coordinate on the inner loop. This means that you're creating the bricks by columns. If you want to see it happen, insert the following line inside the ...
x_coord is incrementing by 10 each time, yet your brick width is set to 30. Looks like you might have mixed your x's and y's up!
x_coord = x_coord + 10;
Instead of 10, you will need to increment by 30 plus whatever you have calculated as the gap.