RLE lib
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2026-03-22 21:21:27 +01:00
parent 284c5aa4c8
commit 2912d7c482
5 changed files with 28 additions and 16 deletions

22
inc/system/system.rle.lua Normal file
View File

@@ -0,0 +1,22 @@
--- @section RLE
RLE = {}
--- Draws an RLE-encoded image.
--- @param runs table Array of run lengths.
--- @param values table Array of pixel values (colors).
function RLE.draw(img_values, img_runs)
local SCREEN_WIDTH=240
local SCREEN_HEIGHT=136
local val_i=0
local run=0
for y=0,SCREEN_HEIGHT-1 do
for x=0,SCREEN_WIDTH-1 do
if run==0 then
val_i=val_i+1
run=img_runs[val_i]
end
run=run-1
pix(x,y,img_values[val_i])
end
end
end