Added memmory usage to debug menu and logging
This commit is contained in:
17
main.lua
17
main.lua
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user