Hi ,thanks for your kind reply.
This is a basic code ,just as a example of my problem:
include "DarkGDK.h"
int iObject = 1;
double dDistance = 100.0;
double dMaxDistance = 800.0;
double dTrackedDistance = 0.0;
double oldtime = 0;
double currtime = 0;
double timediff = 0;
double timefactor = 1.0;
bool bMoving = false;
void Float2String(int iX,int iY,float fValue);
void Control();
void DarkGDK ( void )
{
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 30 );
dbMakeObjectCube(iObject,5.0f);//Some random object to put on the GDK Window
oldtime = GetTickCount();
currtime = oldtime;
// our main loop
while ( LoopGDK ( ) )
{
Control();
// update the screen
Float2String(10,10,dTrackedDistance);
dbSync ( );
oldtime = currtime;
currtime = GetTickCount();
timediff = currtime-oldtime;
timefactor = (timediff / 1000.0f);
}
// return back to windows
return;
}
//Control for the demo
void Control()
{
if(dbKeyState(2)) // 1 key
bMoving = true;
if(dTrackedDistance>=dMaxDistance)
{
bMoving = false;
}
//dTrackedDistance stores the increments of the movement
if(bMoving)
{
dTrackedDistance += dDistance*timefactor;
}
}
//to write text on the GDK window
void Float2String(int iX,int iY,float fValue)
{
char* pstrTemp;
pstrTemp = dbStr(fValue);
dbText(iX,iY,pstrTemp);
delete pstrTemp;
}
Im telling to move a distance of 100 for each second, until it reachs 800. (you can imagine that as meters)
BUT ,it reachs 802-804 or some other value.
Its not too accurate and that is my issue.
Thanks for your help.
EDIT: some typos, im not a native English speaker