From 21f09f86852d7b7b033057cb1c86e06e74acb7d5 Mon Sep 17 00:00:00 2001 From: Aki Date: Sun, 22 May 2016 20:05:01 +0200 Subject: Debug draw upgrade --- world.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'world.lua') diff --git a/world.lua b/world.lua index 2580e0e..cb54b42 100644 --- a/world.lua +++ b/world.lua @@ -85,7 +85,7 @@ end -- Add new platform to the world function World:createPlatform(x, y, polygon, sprite) - table.insert(self.Platforms, Ground:new(self.world, x, y, polygon, sprite)) + table.insert(self.Platforms, Ground:new(self, self.world, x, y, polygon, sprite)) end -- Add new naut to the world @@ -205,6 +205,22 @@ function World:draw() platform:draw(offset_x, offset_y, scale, debug) end + -- draw center + if debug then + local c = self.camera + local w, h = love.graphics.getWidth(), love.graphics.getHeight() + love.graphics.setColor(130,130,130) + love.graphics.setLineWidth(1) + love.graphics.setLineStyle("rough") + local cx, cy = c:getPositionScaled() + local x1, y1 = c:translatePosition(self.map.center_x, cy) + local x2, y2 = c:translatePosition(self.map.center_x, cy+h) + love.graphics.line(x1,y1,x2,y2) + local x1, y1 = c:translatePosition(cx, self.map.center_y) + local x2, y2 = c:translatePosition(cx+w, self.map.center_y) + love.graphics.line(x1,y1,x2,y2) + end + -- Draw HUDs for _,naut in pairs(self.Nauts) do -- I have no idea where to place them T_T -- cgit v1.1