|
From: <ste...@ge...> - 2001-06-20 09:40:45
|
Hey there!
I am trying to make a framerate limiter for my new game, but I can't =
make it work.
I would do it something like this:
#include <time.h>
#include <conio.h>
void frames(void)
{
const float TimePerFrame =3D 1 / 73; /* 73 FPS */
clock_t start, end;
start =3D clock();
while( !kbhit() ) /* GameLoop */
{
end =3D clock(); =20
while( ((end-start)/CLK_TCK) < TimePerFrame )
{
end =3D clock();
}
}
DoSomeGameStuff(); /* Some stuff for da game */
}
I can't see what's wrong, but maybe someone out there can :)
Thanks!
|