How do you syncronize delays with the refresh rate of the monitor? That is, my monitor's refresh rate is 60 Hz. How do I get it so that, when the previous "frame" is done being processed, a delay occurs stopping all function executions, then, when the monitor displays that frame, the function resumes execution and when done, it pauses again until the monitor displays the frame. How is this done? As far as I can tell, it's the sleep function, but since that's in milliseconds and constant (and 16 2/3 is not possible), this doesn't seem to be an option. But then, what if the end user has another refresh rate (like 75 Hz) - how do I get this detail? The "GetSystemMetrics" function doesn't seem to have this. In my other tool I used, I'd use these two functions:
wait(4); // waits 4 frames
sleep(2); // waits 2 seconds (not 2 milliseconds)
The other tool didn't synchronize the frame rate with the monitor, one of its many limitations, and it causes sudden jerks and pauses as a result (since the frame rate was never constant - varying from 55 to 66 fps, averaging 63). With C, I have a chance to have a solution to this issue.