Original Post
Hi! I'm writing a simple 2d game and I'm using dx9 (D3DXSprite) for the graphics. I have a prob with object movement. I'm using time based movement and get the fps like this : there are two functions :
float t0,t1;
void StartFps()
{
t0=(float)GetTickCount();
}
void GetFps()
{
t1=(float)GetTickCount();
fps=1000.0f/(t1-t0);
}
so :
StartFps()
Rendering and stuff
GetFps()
the movement is done like this : if (key_right) xv+=300.0f/fps; ... xPos+=xv/fps; yPos+=yv/fps; The problem is the movement is realy jearky. There must be something wrong with the fps cause I've noticed that for about every third frame the fps drops to the half or so. I Saved the fps for every frame in a file and it looked something like this : 100 100 50 100 100 100 50 100 100 100 47 ... Have someone have an idea how this could be solved? Spe