diff options
author | ubq323 <ubq323@ubq323.website> | 2023-02-25 15:24:33 +0000 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2023-03-14 23:11:13 +0000 |
commit | 3c66e7a4d91e2c891cd3b93346ee1f211eb4b6a5 (patch) | |
tree | d614d872298b11c1e652fb8db9caa212872e7467 /client/drawing2.lua | |
parent | 242a0b4e7deb356a0015fbf536158962ad2ea29c (diff) |
don't draw chunks definitely not on screen; add targeting reticle; save chunks before exiting on sigint; add /tp 'command'
Diffstat (limited to 'client/drawing2.lua')
-rw-r--r-- | client/drawing2.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/client/drawing2.lua b/client/drawing2.lua index e09d7dc..c894e4c 100644 --- a/client/drawing2.lua +++ b/client/drawing2.lua @@ -123,16 +123,27 @@ local function draw_map(camera,map) shader:send("zoom",camera.zoom) love.graphics.setShader(shader) + local cam_tl,cam_br = camera:extents() + local count = CHUNK_SIZE*CHUNK_SIZE for _,ch in map:iter_chunks() do if ch then -- todo: skip chunks that aren't on screen, maybe local htl,hbr = ch.cp:extents() local tl = htl:to_pos() + local br = hbr:to_pos() + + if br.x < cam_tl.x or cam_br.x < tl.x or br.y < cam_tl.y or cam_br.y < tl.y then + -- definitely not visible on screen + -- this does not catch every single nonvisible chunk + goto next + end + set_imesh(ch.imesh) love.graphics.drawInstanced(shape_mesh, count, tl.x, tl.y) end + ::next:: end love.graphics.setShader() |