Module
love.timer
The timer module keeps track of time between frames, so that game
objects can be updated in a FPS-independet fashion. The precision of the
timer is usually 1ms, although this may vary from system to system. Hardware timers
with higher precision are planned, but not implemented at the time of writing.
Examples
Example 7: Sleeping
-
-
- function update(dt)
-
-
-
- love.timer.sleep(10)
- end
Example 9: Timing code
-
-
- function load()
-
- t_start = love.timer.getTime()
-
-
- for i=12,22 do
- local f = love.graphics.newFont(love.default_font, i)
- love.graphics.setFont(f)
- end
-
-
- t_end = love.timer.getTime()
-
- end
-
- function draw()
- love.graphics.draw("Spent " .. (t_end-t_start) .. " seconds loading 10 fonts.", 50, 50)
- end