W3cubDocs

/LÖVE

love.timer.getAverageDelta

Available since LÖVE 0.9.0
This function is not supported in earlier versions.

Returns the average delta time (seconds per frame) over the last second.

Function

Synopsis

delta = love.timer.getAverageDelta( )

Arguments

None.

Returns

number delta
The average delta time over the last second.

Examples

Display text at the top left of the screen showing the average time taken to update and draw each frame.

function love.draw()
   local delta = love.timer.getAverageDelta()
   -- Display the frame time in milliseconds for convenience.
   -- A lower frame time means more frames per second.
   love.graphics.print(string.format("Average frame time: %.3f ms", 1000 * delta), 10, 10)
end

See Also

© 2006–2016 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/love.timer.getAverageDelta