FPS display error
Posted: Thu Jun 10, 2010 10:52 am
hello folks,
Maybe it's a easy problem,i'd like to compute fps by my own.but it displays error.
Right code:
but if i change first sentence to:
"last"has been computed before,it could not display the fps infor,
what's wrong?
Thank you very much!
Maybe it's a easy problem,i'd like to compute fps by my own.but it displays error.
Right code:
Code: Select all
fps = driver->getFPS();
if (lastFPS != fps)
{
core::stringw str = L"Collision detection example - Irrlicht Engine [";
str += driver->getName();
str += "] FPS:";
str += (int)fps;
device->setWindowCaption(str.c_str());
lastFPS = fps;
}
Code: Select all
now = device->getTimer()->getTime();
fps = (int)(1000.0f/(now-last));
what's wrong?
Thank you very much!