Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
J 0.73 KB | None | 0 0
  1. time0 = getTickCount();
  2. while (!bGameDone)
  3.    {
  4.    time1 = getTickCount();
  5.    frameTime = 0;
  6.    int numLoops = 0;
  7.  
  8.    while ((time1 - time0) > TICK_TIME && numLoops < MAX_LOOPS)
  9.       {
  10.       GameTickRun();
  11.       time0 += TICK_TIME;
  12.       frameTime += TICK_TIME;
  13.       numLoops++;
  14.       }
  15.    IndependentTickRun(frameTime);
  16.  
  17.    // If playing solo and game logic takes way too long, discard
  18.    // pending time.
  19.    if (!bNetworkGame && (time1 - time0) > TICK_TIME)
  20.       time0 = time1 - TICK_TIME;
  21.    if (canRender)
  22.       {
  23.       // Account for numLoops overflow causing percent > 1.
  24.       float percentWithinTick = Min(1.f, float(time1 - time0)/TICK_TIME);
  25.       GameDrawWithInterpolation(percentWithinTick);
  26.       }
  27.    }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement