add on-screen performance logging
This commit is contained in:
parent
d7baac52c9
commit
2139c44473
16
main.lua
16
main.lua
@ -29,11 +29,15 @@ function love.load()
|
||||
love.window.setMode(1080, 720, { resizable = true, msaa = 4, vsync = true })
|
||||
end
|
||||
|
||||
local lt = "0"
|
||||
function love.update(dt)
|
||||
local t1 = love.timer.getTime()
|
||||
Tree.controls:poll()
|
||||
Tree.panning:update(dt)
|
||||
Tree.level:update(dt)
|
||||
Tree.controls:cache()
|
||||
local t2 = love.timer.getTime()
|
||||
lt = string.format("%.3f", (t2 - t1) * 1000)
|
||||
end
|
||||
|
||||
local function coverTransform(img, containerW, containerH)
|
||||
@ -45,7 +49,9 @@ local function coverTransform(img, containerW, containerH)
|
||||
return scale, offsetX, offsetY, sw, sh
|
||||
end
|
||||
|
||||
local dt = "0"
|
||||
function love.draw()
|
||||
local t1 = love.timer.getTime()
|
||||
local scale, ox, oy = coverTransform(Tree.assets.files.cats, love.graphics.getWidth(), love.graphics.getHeight())
|
||||
|
||||
love.graphics.push()
|
||||
@ -61,10 +67,12 @@ function love.draw()
|
||||
nil, 1 / 32, 1 / 32)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Tree.level:draw()
|
||||
|
||||
|
||||
Tree.level.camera:detach()
|
||||
|
||||
local stats = "fps: " .. love.timer.getFPS() .. " lt: " .. lt .. " dt: " .. dt
|
||||
love.graphics.print(stats, 10, 10)
|
||||
|
||||
local t2 = love.timer.getTime()
|
||||
dt = string.format("%.3f", (t2 - t1) * 1000)
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user