Implement tcc day 1

This commit is contained in:
rmgr 2022-12-18 21:06:26 +10:30
commit dc560ee691
1 changed files with 47 additions and 0 deletions

47
tcc1.p8 Normal file
View File

@ -0,0 +1,47 @@
pico-8 cartridge // http://www.pico-8.com
version 39
__lua__
-- tinycodechristmas day 1
-- by rmgr
function _draw()
cls(1)
rectfill(0,90,128,128, 11)
rectfill(60, 70, 68, 100, 4)
for i=1,5 do
tri(64,
9 + (i*9),
50 + (-1 * i * 5),
27 + (i*9),
78 + (i * 5),
27 + (i*9),
3)
end
end
function filltri(x1, y1, x2, y2, x3, y3)
invslope1 = (x2-x1)/(y2-y1)
invslope2 = (x3-x1)/(y3-y1)
curpos1 = x1
curpos2 = x1
for s=y1,y2 do
line(curpos1, s, curpos2, s)
curpos1 += invslope1
curpos2 += invslope2
end
end
function tri(x1, y1, x2, y2, x3, y3, c)
line(x1,y1,x2,y2,c)
line(x2,y2,x3,y3,c)
line(x3,y3,x1,y1,c)
filltri(x1,y1,x2,y2,x3,y3)
end
__gfx__
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000