graphics: fix handling of elapsed time

This commit is contained in:
Josh Holtrop 2012-03-07 14:12:34 -05:00
parent ce7a57be64
commit b56c29840c

View File

@ -37,8 +37,11 @@ int main()
}
}
float last_time = Clock.GetElapsedTime();
while (App.IsOpened())
{
float ticks = Clock.GetElapsedTime();
float elapsed = ticks - last_time;
sf::Event Event;
while (App.GetEvent(Event))
{
@ -56,12 +59,12 @@ int main()
it != shapes.end();
it++)
{
it->Rotate(1000 * Clock.GetElapsedTime());
it->Rotate(360.0 / 4 * elapsed);
App.Draw(*it);
}
App.Display();
Clock.Reset();
last_time = ticks;
}
return EXIT_SUCCESS;