Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local termW, termH = term.getSize()
- function drawRelevantImage(img, xPos, yPos)
- for i, v in pairs(img) do
- for k, e in pairs(v) do
- if i + yPos - 1 >= 1 and i + yPos - 1 <= termH and k + xPos - 1 >= 1 and k + xPos - 1 <= termW then
- term.setCursorPos(k + xPos - 1, i + yPos - 1)
- term.setBackgroundColor(e)
- term.write(" ")
- end
- end
- end
- end
- function drawRelevantImage(img, xPos, yPos)
- local termW, termH = term.getSize()
- if yPos > 0 then yTest = false else yTest = true end
- if yPos + #img <= termH then yTest2 = false else yTest2 = true end
- if xPos > 0 then xTest = false else xTest = true end
- if xPos + #img[1] <= termW then xTest2 = false else xTest2 = true end
- for i = yTest and 1 - yPos or 1, yTest2 and termH - yPos or #img do
- for k = xTest and 1 - xPos or 1, xTest2 and termW - xPos or #img[1] do
- term.setCursorPos(k + xPos - 1, i + yPos - 1)
- term.setBackgroundColor(img[i][k])
- term.write(" ")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement