Skip to main content
gamedev.net
🔒 Locked

Delay / Frames

Started by _sid 2 replies 600+ views
Original Post
_sid
_sid
Hi all again :) Got a question: What'sa the best way to dalay a d3d prog? Or set frames per sec? I mean i need to reduce the number of frames per sec and the rendering speed. Dunno if there are some directX functions or properties of CreateDevice. So plz help :) Thx all.
hunta
hunta
Hi!

You just do something like that:

const int FPS = 1000/30;void Mainloop(void){  DWORD dwStartTime = GetTickCount();  // render your stuff  while (GetTickCount()-dwStartTime < FPS)  {    // do nothing  }}


So if the rendering process finished before the given FPS count is reached, your application simply does nothing.

Bye, hunta
_sid
_sid
thx :)
Dookie
Dookie
You can do what hunta posted, or you can move that same routine to the 'render' function of your game. If 'render' is called and the timer hasn't expired, then simply return control to your main gameloop instead of rendering the scene. That way your gameloop can be processing input and sound instead of simply 'stopping' until the timer expires.
"The crows seemed to be calling his name, thought Caw"

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.