High-resolution performance timer
Well you can construct a much higher resolution performance timer by calling the windows api functions:
QueryPerformanceCounter(out long) and
QueryPerformanceFrequency(out long)
Read this article from The Code Project, to learn how to construct your own high-resolution performance timer using windows api calls. :D I just don't know if there is an unknown cost by calling windows api functions from a loop in managed code? :confused: Maybe there is a better solution to the problem... I'm still open to suggestions! ;)
No, I just used the original intended framerate of 30, and not the error-corrected value of 40, to explain why you have had to add 10 to get the correct framerate. Btw, if your TickCount resolution is 16 milliseconds, the true framerate will be 31.25fps when setting the intended framerate to 40fps. That is because the actual time between execution will be 32ms, and not 25ms as 40fps would suggest... ;)
- SysRq