here is the problem:
i need to move object in a certain moment with basic equatations like s=a*(t*t)
time (t) is like (now-startTime)
now=driver->getTimer()->getTime() and so is startTime called before
but i have problem,on faster computer movement isnt the same like on slower ones,how to solve this?
startTime=driver->getTimer()->getTime() is called before
while(device->run())
{
now=driver->getTimer()->getTime();
}
cpu speed independent movement
You'll need to write some code like this:
Using this, the tick() function is called at 10 millisecond intervals, and providing that your code within tick() is executed in under 10ms then time will remain steady between CPU's.
Code: Select all
long lasttick;
void MainLoop()
{
Render(); // draw a frame
if (driver->getTimer()->getTime() > lasttick + 10) {
lasttick = driver->getTimer()->getTime();
Tick();
}
}