Code here: https://gist.github.com/protectivetoast83/25301772cbc6f13e6e07
images of problem
The program should be displaying a single gray rectangle at coordinates 32, 32 on the window however it was also displaying a second one at coordinates 0,0.
I added a cout statement on line 60 of gameWorld.cpp and the program started working correctly. The program works correctly only so long as I have that cout statement there.
What's going on and how can I fix it?
Best How To :
Line 57 of gameWorld.cpp looks suspicious:
That semicolon ends the if statement ("if object i is active, do nothing"), and the subsequent four lines are a bare inner block that always gets executed. (This explains why, in your second screenshot, you're looping over all objects from
99 as shown by the text box in the lower-right corner. It doesn't tell me why adding line 60 changes your code's behaviour, though.)