Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

hi-res counter

Name: Anonymous 2008-10-25 23:17

So I'm coding a game and trying to maintain a steady game speed (ie. framerate) and I found some Windows functions called QueryPerformanceCounter and QueryPerformanceFrequency.

Using these looks more reliable for controlling a game loop than say, clock() shit from time.h or something.  The only problem is that I've seen this:

>If the installed hardware supports a high-resolution performance counter

I've tried it and it works 100% fine on my machine.  But I'm wondering what sort of hardware would NOT support this?  Is it likely that if I distributed my game that many users would not have the performance counter?

Name: Anonymous 2008-10-26 18:04

>>1

QueryPerformanceFrequency and Counter do not work on multiprocessor machines unless you do something like call

SetProcessAffinityMask(GetCurrentProcess(), 1L);

But I dunno because I only have 1 processor.

Name: Anonymous 2008-10-26 19:27

>>12
IIRC they work if you have a HPET, and your OS supports it. Of course, you can't rely on that.

And of course setting the affinity mask is fairly retarded. Imagine if everything did that.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List