Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- com = require("component")
- gl = com.gpu
- write = io.write
- getbg = gl.getBackground
- setbg = gl.setBackground
- getres = gl.getResolution
- xfill = gl.fill
- function loadImage(imgpath)
- a = {true,true,true,true,true,true,true,true,true,true,true}
- ic = true
- al = true
- f = io.open(imgpath, "r")
- a[1] = tonumber(f:read('*l'))
- al = a[1]*5+1
- for ic = 2, al do
- a[ic] = tonumber(f:read("*l"))
- end
- f:close()
- return a
- end
- function drawImage(img)
- bgcol = getbg()
- ic = true
- b = 1
- x1c = true
- x2c = true
- y1c = true
- y2c = true
- col = true
- al = img[1]*5+1
- for ic = 2, al do
- if b == 1 then
- b = 2
- x1c = img[ic]
- elseif b == 2 then
- b = 3
- y1c = img[ic]
- elseif b == 3 then
- b = 4
- x2c = img[ic]
- elseif b == 4 then
- b = 5
- y2c = img[ic]
- elseif b == 5 then
- b = 1
- col = img[ic]
- setbg(col)
- xfill(x1c,y1c,x2c-x1c+1,y2c-y1c+1," ")
- end
- end
- setbg(bgcol)
- end
Add Comment
Please, Sign In to add comment