Skip to content

Instantly share code, notes, and snippets.

@cheapie
Created November 15, 2024 21:46
Show Gist options
  • Select an option

  • Save cheapie/0235bdbb46e401c2eade1900b89d7bcf to your computer and use it in GitHub Desktop.

Select an option

Save cheapie/0235bdbb46e401c2eade1900b89d7bcf to your computer and use it in GitHub Desktop.
if event.type == "program" or event.type == "on" then
local img = {}
for y=1,16,1 do
img[y] = {}
for x=1,16,1 do
img[y][x] = math.random(0,9) >= 5 and "ffffff" or "000000"
end
end
digiline_send("gpu",{
{command="createbuffer",buffer=0,xsize=16,ysize=16,fill="000000"},
{command="load",buffer=0,x=1,y=1,data=img},
})
interrupt(1,"tick")
elseif event.iid == "tick" then
digiline_send("gpu",{
{command="createbuffer",buffer=1,xsize=16,ysize=16,fill="111111"},
{command="createbuffer",buffer=2,xsize=16,ysize=16,fill="000000"},
{command="copy",src=0,dst=1,mode="and",srcx=2,srcy=1,dstx=1,dsty=1,xsize=15,ysize=16}, --Right
{command="copy",src=1,dst=2,mode="add",srcx=1,srcy=1,dstx=1,dsty=1,xsize=15,ysize=16},
{command="createbuffer",buffer=1,xsize=16,ysize=16,fill="111111"},
{command="copy",src=0,dst=1,mode="and",srcx=2,srcy=2,dstx=1,dsty=1,xsize=15,ysize=15}, --Down-Right
{command="copy",src=1,dst=2,mode="add",srcx=1,srcy=1,dstx=1,dsty=1,xsize=15,ysize=15},
{command="createbuffer",buffer=1,xsize=16,ysize=16,fill="111111"},
{command="copy",src=0,dst=1,mode="and",srcx=1,srcy=2,dstx=1,dsty=1,xsize=16,ysize=15}, --Down
{command="copy",src=1,dst=2,mode="add",srcx=1,srcy=1,dstx=1,dsty=1,xsize=16,ysize=15},
{command="createbuffer",buffer=1,xsize=16,ysize=16,fill="111111"},
{command="copy",src=0,dst=1,mode="and",srcx=1,srcy=2,dstx=2,dsty=1,xsize=15,ysize=15}, --Down-Left
{command="copy",src=1,dst=2,mode="add",srcx=2,srcy=1,dstx=2,dsty=1,xsize=15,ysize=15},
{command="createbuffer",buffer=1,xsize=16,ysize=16,fill="111111"},
{command="copy",src=0,dst=1,mode="and",srcx=1,srcy=1,dstx=2,dsty=1,xsize=15,ysize=16}, --Left
{command="copy",src=1,dst=2,mode="add",srcx=2,srcy=1,dstx=2,dsty=1,xsize=15,ysize=16},
{command="createbuffer",buffer=1,xsize=16,ysize=16,fill="111111"},
{command="copy",src=0,dst=1,mode="and",srcx=1,srcy=1,dstx=2,dsty=2,xsize=15,ysize=15}, --Up-Left
{command="copy",src=1,dst=2,mode="add",srcx=2,srcy=2,dstx=2,dsty=2,xsize=15,ysize=15},
{command="createbuffer",buffer=1,xsize=16,ysize=16,fill="111111"},
{command="copy",src=0,dst=1,mode="and",srcx=1,srcy=1,dstx=1,dsty=2,xsize=16,ysize=15}, --Up
{command="copy",src=1,dst=2,mode="add",srcx=1,srcy=2,dstx=1,dsty=2,xsize=16,ysize=15},
{command="createbuffer",buffer=1,xsize=16,ysize=16,fill="111111"},
{command="copy",src=0,dst=1,mode="and",srcx=2,srcy=1,dstx=1,dsty=2,xsize=15,ysize=15}, --Up-Right
{command="copy",src=1,dst=2,mode="add",srcx=1,srcy=2,dstx=1,dsty=2,xsize=15,ysize=15},
})
interrupt(0,"tick2")
elseif event.iid == "tick2" then
digiline_send("gpu",{
{command="createbuffer",buffer=3,xsize=16,ysize=16,fill="000000"},
{command="copy",src=2,dst=3,mode="overlay",transparent="888888",srcx=1,srcy=1,dstx=1,dsty=1,xsize=16,ysize=16},
{command="createbuffer",buffer=2,xsize=16,ysize=16,fill="000000"},
{command="copy",src=3,dst=2,mode="overlay",transparent="777777",srcx=1,srcy=1,dstx=1,dsty=1,xsize=16,ysize=16},
{command="createbuffer",buffer=3,xsize=16,ysize=16,fill="000000"},
{command="copy",src=2,dst=3,mode="overlay",transparent="666666",srcx=1,srcy=1,dstx=1,dsty=1,xsize=16,ysize=16},
{command="createbuffer",buffer=2,xsize=16,ysize=16,fill="000000"},
{command="copy",src=3,dst=2,mode="overlay",transparent="555555",srcx=1,srcy=1,dstx=1,dsty=1,xsize=16,ysize=16},
{command="createbuffer",buffer=3,xsize=16,ysize=16,fill="000000"},
{command="copy",src=2,dst=3,mode="overlay",transparent="444444",srcx=1,srcy=1,dstx=1,dsty=1,xsize=16,ysize=16},
{command="createbuffer",buffer=2,xsize=16,ysize=16,fill="000000"},
{command="copy",src=3,dst=2,mode="overlay",transparent="111111",srcx=1,srcy=1,dstx=1,dsty=1,xsize=16,ysize=16},
{command="createbuffer",buffer=3,xsize=16,ysize=16,fill="000000"},
{command="copy",src=2,dst=3,mode="overlay",transparent="222222",srcx=1,srcy=1,dstx=1,dsty=1,xsize=16,ysize=16},
{command="createbuffer",buffer=4,xsize=16,ysize=16,fill="ffffff"},
{command="copy",src=2,dst=4,mode="overlay",transparent="333333",srcx=1,srcy=1,dstx=1,dsty=1,xsize=16,ysize=16},
{command="createbuffer",buffer=5,xsize=16,ysize=16,fill="ffffff"},
{command="copy",src=4,dst=5,mode="overlay",transparent="222222",srcx=1,srcy=1,dstx=1,dsty=1,xsize=16,ysize=16},
{command="createbuffer",buffer=4,xsize=16,ysize=16,fill="ffffff"},
{command="copy",src=3,dst=4,mode="overlay",transparent="333333",srcx=1,srcy=1,dstx=1,dsty=1,xsize=16,ysize=16},
{command="copy",src=0,dst=5,mode="and",srcx=1,srcy=1,dstx=1,dsty=1,xsize=16,ysize=16},
{command="copy",src=4,dst=5,mode="or",srcx=1,srcy=1,dstx=1,dsty=1,xsize=16,ysize=16},
{command="copy",src=5,dst=0,mode="normal",srcx=1,srcy=1,dstx=1,dsty=1,xsize=16,ysize=16},
{command="send",buffer=0,channel="screen"},
})
interrupt(1,"tick",true)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment