Original Post
Hi everyone,
I'm building a game engine from the ground up using C++ and DirectX. In my main game loop I am calling the function Sleep() each frame, but it doesn't consistently sleep for the time I specify. Instead of sleeping for 16ms for example, it will sleep for roughly 30ms.
I tried a different implementation using a waitable timer (using the functions SetWaitableTimer() and WaitForSingleObject()) and I see similar behavior.
The strange thing (and this might be a red herring) is I saw it work properly once while debugging the game in Visual Studio. However, when I run outside the debugger I get the behavior described above.
Any ideas?
Thanks for any help!
I'm building a game engine from the ground up using C++ and DirectX. In my main game loop I am calling the function Sleep() each frame, but it doesn't consistently sleep for the time I specify. Instead of sleeping for 16ms for example, it will sleep for roughly 30ms.
I tried a different implementation using a waitable timer (using the functions SetWaitableTimer() and WaitForSingleObject()) and I see similar behavior.
The strange thing (and this might be a red herring) is I saw it work properly once while debugging the game in Visual Studio. However, when I run outside the debugger I get the behavior described above.
Any ideas?
Thanks for any help!