graphics: fix handling of elapsed time
This commit is contained in:
parent
ce7a57be64
commit
b56c29840c
@ -37,8 +37,11 @@ int main()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float last_time = Clock.GetElapsedTime();
|
||||||
while (App.IsOpened())
|
while (App.IsOpened())
|
||||||
{
|
{
|
||||||
|
float ticks = Clock.GetElapsedTime();
|
||||||
|
float elapsed = ticks - last_time;
|
||||||
sf::Event Event;
|
sf::Event Event;
|
||||||
while (App.GetEvent(Event))
|
while (App.GetEvent(Event))
|
||||||
{
|
{
|
||||||
@ -56,12 +59,12 @@ int main()
|
|||||||
it != shapes.end();
|
it != shapes.end();
|
||||||
it++)
|
it++)
|
||||||
{
|
{
|
||||||
it->Rotate(1000 * Clock.GetElapsedTime());
|
it->Rotate(360.0 / 4 * elapsed);
|
||||||
App.Draw(*it);
|
App.Draw(*it);
|
||||||
}
|
}
|
||||||
|
|
||||||
App.Display();
|
App.Display();
|
||||||
Clock.Reset();
|
last_time = ticks;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user