2021-10-16 23:06:11 +00:00
|
|
|
function DebugUI()
|
2022-01-31 14:03:14 +00:00
|
|
|
local mouse_x, mouse_y = love.mouse.getPosition()
|
|
|
|
for _, light in pairs(Lights) do
|
|
|
|
love.graphics.print(light.pos.x,light.pos.x,light.pos.y)
|
|
|
|
love.graphics.print(light.pos.y,light.pos.x,light.pos.y+20)
|
|
|
|
love.graphics.print(light.pos.x,light.pos.x,light.pos.y+40)
|
|
|
|
end
|
2021-10-25 23:19:22 +00:00
|
|
|
|
2022-01-31 14:03:14 +00:00
|
|
|
love.graphics.print("time: "..fps_total..", fps: "..fps_draw..", frametime: "..math.floor(current_dt* 1000).."ms", 10*textScale, 0*textScale, 0, textScale)
|
|
|
|
love.graphics.print(--[["CPUtime: "..checkCPUTime("total")..", CPU: "..(math.floor(checkCPUTime("get")*10000)/100).."%,]] "memoryUsage: "..memoryUsage.."kB", 10*textScale, 20*textScale, 0, textScale)
|
2021-10-16 23:06:11 +00:00
|
|
|
|
2022-01-31 14:03:14 +00:00
|
|
|
love.graphics.setColor(1,1,1)
|
|
|
|
-- lots of variables
|
|
|
|
love.graphics.print("[main_Player]",10*textScale,40*textScale, 0, textScale)
|
|
|
|
love.graphics.print("position: {"..main_Player.pos.x..", "..main_Player.pos.y.."}",10*textScale,60*textScale, 0, textScale)
|
|
|
|
love.graphics.print("velocity: {"..main_Player.vel.x..", "..main_Player.vel.y.."}",10*textScale,80*textScale, 0, textScale)
|
|
|
|
love.graphics.print("scale: {"..main_Player.sprite_scale.x..", "..main_Player.sprite_scale.y.."}",10*textScale,100*textScale, 0, textScale)
|
|
|
|
love.graphics.print("states: \"isOnGround\": "..tostring(main_Player.isOnGround),10*textScale,120*textScale, 0, textScale)
|
|
|
|
love.graphics.print("\"coyoteValue\": "..tostring(main_Player.coyoteValue),10*textScale,140*textScale, 0, textScale)
|
2021-10-16 23:06:11 +00:00
|
|
|
|
2022-01-31 14:03:14 +00:00
|
|
|
love.graphics.print("[Camera]",10*textScale,160*textScale, 0, textScale)
|
|
|
|
love.graphics.print("position: {"..Camera.pos.x..", "..Camera.pos.y.."}",10*textScale,180*textScale, 0, textScale)
|
|
|
|
love.graphics.print("size: {"..Camera.width..", "..Camera.height.."}",10*textScale,200*textScale, 0, textScale)
|
2021-10-16 23:06:11 +00:00
|
|
|
|
2022-01-31 14:03:14 +00:00
|
|
|
love.graphics.print("[Cursor]",10*textScale,220*textScale, 0, textScale)
|
|
|
|
love.graphics.print("position: {"..mouse_x+Camera.pos.x..", "..mouse_y+Camera.pos.y.."}",10*textScale,240*textScale, 0, textScale)
|
2022-01-29 07:49:45 +00:00
|
|
|
|
2022-01-31 14:03:14 +00:00
|
|
|
love.graphics.print(textScale,10*textScale,240*textScale, 0, textScale)
|
|
|
|
love.graphics.print("Level: "..levelNum.." / "..#levelList.." \""..currLevel.."\"",10*textScale,260*textScale, 0, textScale)
|
2021-10-16 23:06:11 +00:00
|
|
|
|
2022-01-31 14:03:14 +00:00
|
|
|
-- player isOnGroundCheck
|
|
|
|
love.graphics.setColor(1,0,0)
|
2021-10-16 23:06:11 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function DebugColisions()
|
2022-02-17 23:03:32 +00:00
|
|
|
-- DrawColisionTable()
|
|
|
|
LoadedObjects.DrawCollisions()
|
2021-10-16 23:06:11 +00:00
|
|
|
end
|
2021-11-28 02:38:30 +00:00
|
|
|
|
|
|
|
function DebugEntities()
|
2022-01-21 14:56:25 +00:00
|
|
|
for _, particle in pairs(LoadedParticles) do
|
2022-01-29 07:49:45 +00:00
|
|
|
particle:Debug()
|
2022-01-21 14:56:25 +00:00
|
|
|
end
|
2022-02-10 17:18:37 +00:00
|
|
|
for _, enty in pairs(LoadedObjects.Entities) do
|
2022-01-29 07:49:45 +00:00
|
|
|
enty:Debug()
|
2021-11-28 02:38:30 +00:00
|
|
|
end
|
|
|
|
end
|
2022-01-31 14:03:14 +00:00
|
|
|
|
|
|
|
--[[CPUUsage = {}
|
|
|
|
function checkCPUTime(action, name)
|
|
|
|
if name then
|
|
|
|
if action == "start" then
|
|
|
|
if CPUUsage.name == nil then CPUUsage.name = {} end
|
|
|
|
CPUUsage.name.start = os.clock()
|
|
|
|
elseif action == "fin" then
|
|
|
|
CPUUsage.name.fin = os.clock()
|
|
|
|
CPUUsage.name.use = CPUUsage.name.fin - CPUUsage.name.start
|
|
|
|
if CPUUsage.name.total == nil then CPUUsage.name.total = 0 end
|
|
|
|
CPUUsage.name.total = CPUUsage.name.total + CPUUsage.name.use
|
|
|
|
print(CPUUsage.name.fin.." : "..CPUUsage.name.use.." : "..CPUUsage.name.total)
|
|
|
|
elseif action == "get" then
|
|
|
|
return CPUUsage.name.use
|
|
|
|
elseif action == "total" then
|
|
|
|
return CPUUsage.name.total
|
|
|
|
else
|
|
|
|
return CPUUsage.name.use
|
|
|
|
end
|
|
|
|
-- Totals
|
|
|
|
else
|
|
|
|
if action == "get" then
|
|
|
|
local currentTotalCPU = 0
|
|
|
|
for _, timings in ipairs(CPUUsage) do
|
|
|
|
currentTotalCPU = currentTotalCPU + CPUUsage.timings.use
|
|
|
|
end
|
|
|
|
return currentTotalCPU
|
|
|
|
elseif action == "total" then
|
|
|
|
local currentTotalCPU = 0
|
|
|
|
for _, timings in ipairs(CPUUsage) do
|
|
|
|
currentTotalCPU = currentTotalCPU + CPUUsage.timings.total
|
|
|
|
end
|
|
|
|
return currentTotalCPU
|
|
|
|
else
|
|
|
|
local currentTotalCPU = 0
|
|
|
|
for _, timings in ipairs(CPUUsage) do
|
|
|
|
currentTotalCPU = currentTotalCPU + CPUUsage.timings.use
|
|
|
|
end
|
|
|
|
return currentTotalCPU
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end]]
|
2022-02-07 08:36:16 +00:00
|
|
|
|
|
|
|
function logPrint(string)
|
|
|
|
if logging then print(string) end
|
2022-02-07 08:58:33 +00:00
|
|
|
logWrite(string)
|
2022-02-07 08:36:16 +00:00
|
|
|
end
|
2022-02-07 08:41:53 +00:00
|
|
|
|
|
|
|
function logWrite(string)
|
2022-02-08 09:23:42 +00:00
|
|
|
if logging then logFile:write(string.."\n") end
|
2022-02-07 08:41:53 +00:00
|
|
|
end
|