MCPcopy Create free account
hub / github.com/diasurgical/devilution / LimitFrameRate

Function LimitFrameRate

SourceX/dx.cpp:239–249  ·  view source on GitHub ↗

* @brief Limit FPS to avoid high CPU load, use when v-sync isn't available */

Source from the content-addressed store, hash-verified

237 * @brief Limit FPS to avoid high CPU load, use when v-sync isn't available
238 */
239void LimitFrameRate()
240{
241 static uint32_t frameDeadline;
242 uint32_t tc = SDL_GetTicks() * 1000;
243 uint32_t v = 0;
244 if (frameDeadline > tc) {
245 v = tc % refreshDelay;
246 SDL_Delay(v / 1000 + 1); // ceil
247 }
248 frameDeadline = tc + v + refreshDelay;
249}
250
251void RenderPresent()
252{

Callers 1

RenderPresentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected