summaryrefslogtreecommitdiff
path: root/client/drawing.lua
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2023-02-03 19:37:28 +0000
committerubq323 <ubq323@ubq323.website>2023-02-03 19:51:07 +0000
commit1ebd7d9b7b62c8e05d527611a1944ed1a876b890 (patch)
treecfc5ddf3fc15985c4369aa12d56de5fa8d6fc7e5 /client/drawing.lua
parentec6a391cb9cf0c0feac0fe3615a59cc7cb6db2d5 (diff)
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
Diffstat (limited to 'client/drawing.lua')
-rw-r--r--client/drawing.lua19
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