mirror of
https://github.com/love2d/love.git
synced 2026-08-20 04:30:09 +02:00
Make love.timer.getFPS and love.timer.getAverageDelta microsecond-accurate
This commit is contained in:
@@ -71,12 +71,12 @@ void Timer::step()
|
|||||||
prevTime = currTime;
|
prevTime = currTime;
|
||||||
|
|
||||||
// Get ticks from SDL
|
// Get ticks from SDL
|
||||||
currTime = SDL_GetTicks();
|
currTime = getMicroTime();
|
||||||
|
|
||||||
// Convert to number of seconds
|
// Convert to number of seconds
|
||||||
dt = (currTime - prevTime)/1000.0;
|
dt = currTime - prevTime;
|
||||||
|
|
||||||
double timeSinceLast = (currTime - prevFpsUpdate)/1000.0;
|
double timeSinceLast = currTime - prevFpsUpdate;
|
||||||
// Update FPS?
|
// Update FPS?
|
||||||
if (timeSinceLast > fpsUpdateFrequency)
|
if (timeSinceLast > fpsUpdateFrequency)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user