diff options
Diffstat (limited to 'client/drawing.lua')
-rw-r--r-- | client/drawing.lua | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/client/drawing.lua b/client/drawing.lua index 111b2e2..bbcf03a 100644 --- a/client/drawing.lua +++ b/client/drawing.lua @@ -33,7 +33,6 @@ local colors = { c(255,128,0), -- orange c(192,192,64), -- yellow c(0,192,0), -- green - c(0,192,192), -- teal c(64,64,255), -- blue c(192,0,192), -- purple @@ -67,14 +66,14 @@ end local function draw_chunk(camera,the_chunk) local tl,br = camera:extents() local tlh,brh = tl:to_hex():round(), br:to_hex():round() - local trh = coords.Pos.make(br.x,tl.y):to_hex():round() + local trh = coords.Pos:make(br.x,tl.y):to_hex():round() for r = tlh.r-1,brh.r+1 do local rowidx = r-tlh.r local minq = tlh.q - math.floor((rowidx+1)/2) local maxq = minq+(trh.q-tlh.q)+1 for q = minq,maxq do - local h = coords.Hex.make(q,r) + local h = coords.Hex:make(q,r) local t = the_chunk:at(h) if type(t) == "number" then draw_hex(h:to_pos(),colors[t],camera.zoom) @@ -84,6 +83,20 @@ local function draw_chunk(camera,the_chunk) end end + if _G.debugmode then + love.graphics.setColor(0,1,0) + + local function p(q,r) return coords.Hex:make(q,r):to_pos() end + local h = chunk.SIZE-0.5 + local c00 = p(-0.5,-0.5) + local c01 = p(-0.5,h) + local c10 = p(h,-0.5) + local c11 = p(h,h) + + love.graphics.polygon("line", + c00.x,c00.y, c01.x,c01.y, c11.x,c11.y, c10.x, c10.y) + end + end |