mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
Make love.timer.getFPS more accurate
Hopefully this was causing issue #377, otherwise, it was still an improvement
This commit is contained in:
@@ -70,10 +70,11 @@ namespace sdl
|
|||||||
// Convert to number of seconds
|
// Convert to number of seconds
|
||||||
dt = (currTime - prevTime)/1000.0;
|
dt = (currTime - prevTime)/1000.0;
|
||||||
|
|
||||||
|
int timeSinceLast = (currTime - prevFpsUpdate)/1000.0;
|
||||||
// Update FPS?
|
// Update FPS?
|
||||||
if ((currTime - prevFpsUpdate)/1000.0 > fpsUpdateFrequency)
|
if (timeSinceLast > fpsUpdateFrequency)
|
||||||
{
|
{
|
||||||
fps = frames/fpsUpdateFrequency;
|
fps = frames/timeSinceLast;
|
||||||
prevFpsUpdate = currTime;
|
prevFpsUpdate = currTime;
|
||||||
frames = 0;
|
frames = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user