I am getting a strange bug when I try and display sprites. It is 100% my fault somewhere in my code, and I have been trying to narrow it down. I'm just asking for more ways to narrow it down. I have a loop that loops over this line:
rWindow.draw( (**it_comp).getSprite() );
1. There are a total of 7 sprites, and I confirmed that the loop is calling that function 7 times, so it is definitely attempting to draw the sprites.
2. I have also confirmed that the 7 sprites all have acceptable values for these:
color
position
texturerect
scale
3. Because of position, I can look right at the spot the sprite should be, but it is not there.
What other values of the sprites could I check to see if they are causing them to be invisible?4. I know it's not hiding behind other sprites. Unless it can hide behind the background fill color of the window.
More detailed explanation(but not necessary to answer above question):1. The bug disappears when I use a debugger (not my question):
http://stackoverflow.com/questions/7112436/c-vs-2010-bugs-occur-only-when-running-without-a-debugger2. The bug occurs somewhat randomly to certain sprites.
3. The bug only occurs if I initialize a new graphics component in a somewhat strange way, but that shouldn't be causing any problems.
4. Because the debugger never gives a warning(it does If i have seg faults or bad memory) I know it's not some sort of pointer problem (right?)
I have a graphics component factory which holds graphics components. Each graphics component holds a sprite. There is a loop that loops over these graphics components, gets a const reference to the sprite, and as you can see, uses the window to draw it.
The view never changes, and I have checked those 4 values for strange readings and they all come back normal. I'm not sure what else to check.