Advertisement
Guest User

Untitled

a guest
Dec 16th, 2018
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. void Game::RunMainloop()
  2. {
  3.     sf::Clock clock;
  4.     Scene* s = scenes.top();
  5.     while (MainWindow->isOpen())
  6.     {
  7.         MainWindow->clear();
  8.  
  9.         float UpdateTime = 0;
  10.        
  11.         while (UpdateTime < 1000.f / 60.f)
  12.         {
  13.             sf::Time time = clock.getElapsedTime();
  14.             UpdateTime += time.asMilliseconds();
  15.  
  16.             s->HandleEvents(*MainWindow);
  17.             s->UpdateScene(clock);
  18.         }
  19.         s->RenderScene(*MainWindow);
  20.  
  21.         MainWindow->display();
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement