Advertisement
koronabora

Untitled

May 7th, 2020
624
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. static const long long BASE_DELAY = 1000 / GAMELOOP_FPS;
  2.  
  3. void GameThread::_wait()
  4. {
  5.     std::chrono::steady_clock::time_point curTime = std::chrono::steady_clock::now();
  6.     long long delay = BASE_DELAY - std::chrono::duration_cast<std::chrono::milliseconds>(curTime - _lastRunTime).count();
  7.     if (delay > 0)
  8.         QThread::msleep(delay);
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement