diff --git a/src/rcore.c b/src/rcore.c index 3efa67b2c939..58ecd4e38a88 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -1230,14 +1230,16 @@ int GetFPS(void) static int index = 0; static float history[FPS_CAPTURE_FRAMES_COUNT] = { 0 }; - static float average = 0, last = 0; + static float average = 0, wait = FPS_STEP; float fpsFrame = GetFrameTime(); if (fpsFrame == 0) return 0; - if ((GetTime() - last) > FPS_STEP) + wait += fpsFrame; + + if (wait > FPS_STEP) { - last = (float)GetTime(); + wait = 0; index = (index + 1)%FPS_CAPTURE_FRAMES_COUNT; average -= history[index]; history[index] = fpsFrame/FPS_CAPTURE_FRAMES_COUNT;