From 1ebd7d9b7b62c8e05d527611a1944ed1a876b890 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Fri, 3 Feb 2023 19:37:28 +0000 Subject: debug drawing change, zoom clamping, partial refactoring of class mechanisms to allow inheritance, minor refactor of noise generator, changes to temp worldgen, rework of class constructor mechanism --- client/drawing.lua | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'client/drawing.lua') 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 -- cgit v1.2.3