Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Jun 14th, 2018 46 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. UINT TARGET_RESOLUTION = 1; // 1 millisecond target resolution
  2. TIMECAPS tc;
  3. UINT wTimerRes = 0;
  4. if (TIMERR_NOERROR == timeGetDevCaps(&tc, sizeof(TIMECAPS)))
  5. {
  6.     wTimerRes = std::min(std::max(tc.wPeriodMin, TARGET_RESOLUTION), tc.wPeriodMax);
  7.     timeBeginPeriod(wTimerRes);// request minimum time resolution to 1
  8. }
  9.    
  10. while(true)//main loop
  11. {
  12.     mainGameLoop();
  13.     int workedTime= calculateWorkedTime();// miliseconds
  14.     if(workedTime < 1000/60)// target 60fps
  15.     {
  16.         int remainingTime = 1000/60 - workedTime;
  17.         Sleep(remainingTime);
  18.     }
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top