I fixed a lot of bugs and now speed check has a new design and a better perfomance. (and it finally works!)
An example of using:
Code: Select all
require("speedtest")
function love.load()
speed.load() --load speed check AFTER set the window-size!
end
function love.update()
speed:start("example")
local text = ""
for i=1,1000 do
text = text.."something "
end
speed:stop("example")
end
function love.draw()
speed.draw() --draw the results
end
more examples: (don't forget require, speed.load() and speed.draw())
Code: Select all
function love.keypressed(key)
if key==" " then
speed.start("example")
love.timer.sleep(0.01) --here is something to check, for example sleeping for 10 ms
speed.stop("example")
end
end
Code: Select all
function love.load()
speed.start("example")
love.graphics.newImage("image.png") --how much time it will need to load?
speed.stop("example")
end
Speed check has a diagram were you can see the max deltatime in ms of 1 second and two lines, one the limit for 60FPS and one for 24FPS.
functions
speed.start(name)
--start a check
speed.stop(name)
--stop a check
speed.draw()
--draw the results of all checks an the diagram
speed.load()
--load or reload speed check