Im working on a simple game for a contest and i need help with this direct draw timing. My problem is on the game loop. When it runs through the loop it causes graphic coruption and is going faster then i need it. but when i had it on a timer it caused graphic coruption.

What i need it a way to time it to 30 Frames Per Second and a way to check if it is done drawing the image, so it doesn't draw when it is drawing the image before.( i saw this feature in another code sample but i lost it)