Skip to content

Commit

Permalink
Expanded Debug-Options
Browse files Browse the repository at this point in the history
User can now toggle between EntityDebugModes by pressing the 1-3 keys
  • Loading branch information
Shroompow committed May 19, 2017
1 parent 01a0789 commit b1b04e6
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions Debug.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
local debugScript = {
show_debug = true, --TODO[ ] Set to false on release
button_pressed = false
entities_mode = 0,
toggle_pressed = false
}

debug_text = "I like debugging - Toggle with 0"
debug_text = "I like debugging - Hide with 0 - Change modes with 1-3"
debug_tbl1 = {one_no = "entries"}
debug_tbl2 = {two_no = "entries"}
debug_entity = nil
Expand All @@ -12,8 +13,20 @@ function debugScript:displayEntities()
if not debugScript.show_debug then return end

local entList = Isaac.GetRoomEntities()
for i = 1, #entList, 1 do
Isaac.RenderText(tostring(entList[i].Type) .. " " .. tostring(entList[i].Variant) .. " " .. tostring(entList[i].SubType), 40, 10 + (10*i), 255, 0, 0, 255)
if debugScript.entities_mode == 0 then
for i = 1, #entList, 1 do
Isaac.RenderText(tostring(entList[i].Type) .. " " .. tostring(entList[i].Variant) .. " " .. tostring(entList[i].SubType), 40, 10 + (10*i), 255, 0, 0, 255)
end

elseif debugScript.entities_mode == 1 then
for i = 1, #entList, 1 do
local p = Isaac.WorldToRenderPosition(entList[i].Position,true)
--Isaac.RenderText(tostring(entList[i].Type) .. " " .. tostring(entList[i].Variant) .. " " .. tostring(entList[i].SubType), p.X, p.Y, 255, 0, 0, 0.5)
Isaac.RenderScaledText(tostring(entList[i].Type) .. " " .. tostring(entList[i].Variant) .. " " .. tostring(entList[i].SubType), p.X, p.Y, 0.5, 0.5, 255, 0, 0, 0.5)
end

elseif debugScript.entities_mode == 2 then

end
end

Expand Down Expand Up @@ -47,12 +60,20 @@ end

function debugScript:checkToggle()
if Input.IsButtonPressed(Keyboard.KEY_0,0) then
if debugScript.button_pressed ~= true then
debugScript.button_pressed = true
if debugScript.toggle_pressed ~= true then
debugScript.toggle_pressed = true
debugScript.show_debug = not debugScript.show_debug
end
else
debugScript.button_pressed = false
debugScript.toggle_pressed = false
end

if Input.IsButtonPressed(49,0) then --Key1
debugScript.entities_mode = 0
elseif Input.IsButtonPressed(50,0) then --Key2
debugScript.entities_mode = 1
elseif Input.IsButtonPressed(51,0) then --Key3
debugScript.entities_mode = 2
end
end

Expand Down

0 comments on commit b1b04e6

Please sign in to comment.