Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: frameTime is always 0  (Read 947 times)

0 Members and 1 Guest are viewing this topic.

pighead10

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
    • Hog Pog
frameTime is always 0
« on: January 18, 2012, 05:04:11 pm »
The frametime is always 0 and I cannot understand why.

I am using sfml 2.0.

Code: [Select]
while(!m_bShutdown){
if(!SfmlFramework::Singleton()->window->IsOpened())m_bShutdown = true;



//capture input and handle application-wide events
sf::Event evt;
while(SfmlFramework::Singleton()->window->PollEvent(evt)){
switch(evt.Type){
case sf::Event::KeyPressed:
m_ActiveStateStack.back()->keyPressed(evt.Key.Code);
break;
case sf::Event::KeyReleased:
m_ActiveStateStack.back()->keyReleased(evt.Key.Code);
break;
case sf::Event::MouseMoved:
m_ActiveStateStack.back()->mouseMoved(sf::Vector2f(evt.MouseMove.X,evt.MouseMove.Y));
break;
case sf::Event::MouseButtonPressed:
m_ActiveStateStack.back()->mousePressed(evt.MouseButton.Button);
break;
case sf::Event::MouseButtonReleased:
m_ActiveStateStack.back()->mouseReleased(evt.MouseButton.Button);
break;
case sf::Event::Closed:
m_bShutdown = true;
break;
default:
break;
}
}
std::cout << "AppStateManager update " << frameTime << std::endl;
m_ActiveStateStack.back()->update(frameTime);

frameTime = SfmlFramework::Singleton()->window->GetFrameTime();
}
Immortui - Zombie puzzle game: http://immortui.hogpog.co.uk

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32502
    • View Profile
    • SFML's website
    • Email
frameTime is always 0
« Reply #1 on: January 18, 2012, 05:53:28 pm »
Since time is an integer number of milliseconds, it will be zero if your FPS is bigger than 1000.
Laurent Gomila - SFML developer