diff options
Diffstat (limited to 'bump/bump_debug.lua')
-rw-r--r-- | bump/bump_debug.lua | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/bump/bump_debug.lua b/bump/bump_debug.lua new file mode 100644 index 0000000..308608f --- /dev/null +++ b/bump/bump_debug.lua @@ -0,0 +1,31 @@ + +local bump = require 'bump' + +local bump_debug = {} + +local function getCellRect(world, cx,cy) + local cellSize = world.cellSize + local l,t = world:toWorld(cx,cy) + return l,t,cellSize,cellSize +end + +function bump_debug.draw(world) + local cellSize = world.cellSize + -- local font = love.graphics.getFont() + local fontHeight = 20 + local topOffset = (cellSize - fontHeight) / 2 + for cy, row in pairs(world.rows) do + for cx, cell in pairs(row) do + local l,t,w,h = getCellRect(world, cx,cy) + local intensity = cell.itemCount * 12 + 16 + jin.graphics.setColor(255,255,255,intensity) + jin.graphics.rect('fill', l,t,w,h) + jin.graphics.setColor(255,255,255, 64) + -- jin.graphics.printf(cell.itemCount, l, t+topOffset, cellSize, 'center') + jin.graphics.setColor(255,255,255,10) + jin.graphics.rect('line', l,t,w,h) + end + end +end + +return bump_debug |