Added memmory usage to debug menu and logging

This commit is contained in:
bizcochito
2022-01-31 15:03:14 +01:00
parent ed3d8a90ec
commit b4311064f6
2 changed files with 85 additions and 26 deletions

View File

@@ -1,4 +1,6 @@
function love.load()
--logging = true
if logging then print("love: "..collectgarbage("count").." kB") end
arrow = 0
do_pause = false
@@ -54,6 +56,9 @@ function love.load()
--CursedBook:New(180,68)
gravity = 0.2
-- Debug and log stuff
memoryUsage, dtcount = 0, 0
if logging then print("mothback: "..collectgarbage("count").." kB, Loading time: "..os.clock().." seconds") end
end
function love.update(dt)
@@ -68,6 +73,18 @@ function love.update(dt)
fps_count = fps_count + 1
current_dt = dt
-- things per second
dtcount = dtcount + dt
if dtcount >= 1 then
if secs == nil then secs = 0 end
secs = secs + 1
dtcount = dtcount - 1
if debug or logging then
memoryUsage = math.floor(collectgarbage("count"))
end
if logging then print("Second "..secs..": "..memoryUsage.." kB") end
end
--keypressed
if Keybind:HasPressed(Keybind.menu.pause) then
if do_pause then