SFML community forums

Help => General => Topic started by: shakenbake158 on December 16, 2014, 12:09:01 am

Title: Help With Replacement for GetFrameTime()
Post by: shakenbake158 on December 16, 2014, 12:09:01 am
Hey guys, I am following a tutorial for SFML, and it is a bit outdated. The tutorial is using a function called GetFrameTime that is no longer supported in SFML.

void GameObjectManager::UpdateAll()
{
  std::map<std::string,VisibleGameObject*>::const_iterator itr =
                                              _gameObjects.begin();
  float timeDelta = Game::GetWindow().GetFrameTime();

  while(itr != _gameObjects.end())
  {
    itr->second->Update(timeDelta);
    itr++;
  }
 
}


How would I replace the GetFrameTime function here?
Title: Re: Help With Replacement for GetFrameTime()
Post by: G. on December 16, 2014, 12:20:35 am
Take a look at the official SFML time tutorial (http://www.sfml-dev.org/tutorials/2.1/system-time.php). In the very last code snippet on this page the computation of elapsed is pretty much the same as the old GetFrameTime.