title: Is there a frame rate cap built into SDL 2.0?
body: <p>I was wondering if there is a frame rate cap built into SDL 2.0? If so, how could one modify the default cap?</p>
  
  <p>I am creating a game engine using C++ and SDL 2.0. When I display what I believe to be the frame rate as rendered text onto the screen, the displayed result constantly fluctuates between 58 and 62 frames per second.</p>
  
  <p>This seems odd to me as no matter how many images I render on the screen, or how much logic code work I put into a single cycle, the displayed frame rate remains within 58 to 62 frames per second.</p>
  
  <p>Here is how I am calculating the frame rate:</p>
  
  <pre><code>// FPS
  //Record the current system ticks
  mSystemTicksCurrent = Timer::GetSystemTicks();
  
  //Calculate the time it takes for a single cycle to run
  mSingleCycle = mSystemTicksCurrent - mSystemTicksPrevious;
  
  //to prevent division by zero...
  if(mSingleCycle != 0)
  {
      mFPS = 1000.0f / mSingleCycle;
  }
  //...indicate that a miniscule amount of time has elapsed, thus leading to an extremely fast frame rate
  else
  {
      mFPS = 9999.9f;
  }
  
  
  //Since we are done calculating the time it has taken for a single cycle to elapse,
  //record the time that was used to calculate the elapsed cycle time for future use.
  mSystemTicksPrevious = mSystemTicksCurrent;
  </code></pre>
  
  <p>and now I take the calculated frame rate and render it to the screen:</p>
  
  <pre><code>if(mpTimerFPS != nullptr)
  {
      if(mpTimerFPSText != nullptr)
      {
          sprintf_s(mTimerFPSTextBuff, "FPS: %.1f", mFPS);
          mpTimerFPSText-&gt;SetTexture(Window::UpdateText(mTimerFPSTextBuff, mpTimerFPSFont, mTimerFPSColor));
      }
  }
  </code></pre>
  
  <p>Where the Timer::GetSystemTicks() function is simply as follows:</p>
  
  <pre><code>Uint32 Timer::GetSystemTicks()
  {
      return timeGetTime();
  }
  </code></pre>
  
  <p>I can provide more code if necessary.</p>