Delta time
Posted: Sat Sep 19, 2009 3:16 pm
it seems peaple are still asking about delta time (which makes vitek write the code to them....about 25% of vitek posts is wrting this code lol...just kidding )
here it is the code we all know:
here it is the code we all know:
Code: Select all
while(device->run())
{
u32 now = timer->getTime();
f32 elapsedSeconds = (now - then) / 1000.f;
if(elapsedSeconds>=deltatime)
{
driver->beginScene(true, true, SColor(255,100,101,140));
smgr->drawAll();
guienv->drawAll();
then = now;
driver->endScene();
///////////////////////////////
int fps = driver->getFPS();
if (lastFPS != fps)
{
core::stringw str = L"Delta time - Irrlicht Engine ["; str += driver->getName();
str += "] FPS:";
str += fps;
device->setWindowCaption(str.c_str());
lastFPS = fps;}
//////////////////////////////
}}