XNA Question!
While fiddling with XNA I noticed something a bit wierd. I have a drawable game component which works as it should do. However, if I place a breakpoint in the update and draw functions, it hits the update function 30 times for every time it calls draw. The update function simply moves the object a few pixels, and without the break points it seems to function correctly, but with the break points in, the object jumps as it is not calling draw as often as it calls update. Does anyone know why this is happening?
I hope this makes sense.
cheers
Are you sure they are called the same number of times without the break-point?
Try displaying a shared variable, that you increase in Update and decrease in Draw.
Just a guess, but perhaps when it breaks, the pause before you click continue is interpreted as a delay in the drawing or game logic, and it tries to catch up by running more updates before displaying again. Try putting a Sleep in it and see if you get the same behavior.
Try displaying a shared variable, that you increase in Update and decrease in Draw.
Just a guess, but perhaps when it breaks, the pause before you click continue is interpreted as a delay in the drawing or game logic, and it tries to catch up by running more updates before displaying again. Try putting a Sleep in it and see if you get the same behavior.
This is actually by design, as explained here. Your breakpoint is making the render loop lag behind, so it'll call Update() a bunch of times while skipping Draw() in an effort to catch up. Please go badger Shawn that it is in fact not intuitive as I argued back then [smile]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement