add camera movement to render

This commit is contained in:
justuswolff
2026-02-17 01:11:27 +01:00
parent f67e633014
commit ba73537eb1

View File

@@ -384,10 +384,13 @@ local function render(buf, pbuf, cx,cy,cz, tx,tz, sx,sz, shouldsetlist,invertsli
1,
}
local tsx,tsy = term.getSize()
local camx,camy = cx+tsx/2,cz+tsy/2
reset()
for x=1,sx,1 do
for z=1,sz,1 do
local currentbuf = pbuf[posasstring(x, cy, z)]
for x=1+camx,sx+camx,1 do
for z=1+camy,sz+camy,1 do
local currentbuf = pbuf[posasstring(x-camx, cy, z-camy)]
term.setCursorPos(x, z)
if currentbuf then -- wall
term.blit(" ", colors.toBlit(colors.white), colors.toBlit(colors.white))