Ok. i'm programming a game in DirectX and I need to lock my frame rate to 30fps. How do i do this? Please someone give me some code or atleast a good function I can use to get the time with precision.
Ok. i'm programming a game in DirectX and I need to lock my frame rate to 30fps. How do i do this? Please someone give me some code or atleast a good function I can use to get the time with precision.
I don't think that is possible.
It may be possible to CAP a frame rate of 30 fps, but if the kernel doesn't serve up resources fast enough to maintain 30fps, then you can't make it.
As for capping, you can probably do that with some efficient language constructs.
Just take a split in millliseconds when you draw, and when you are ready to draw again, check that at least 33 milliseconds have passed since your last split, and if not, hold the redraw, or anything else you wanna hold up, until that happens