Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- FILLEDBOX
- local function drawPixelInternal(xPos, yPos)
- term.setCursorPos(xPos, yPos)
- term.write(" ")
- end
- local tColourLookup = {}
- for n = 1, 16 do
- tColourLookup[string.byte("0123456789abcdef", n, n)] = 2 ^ (n - 1)
- end
- function drawFilledBox(startX, startY, endX, endY, nColour)
- if type(startX) ~= "number" or type(startX) ~= "number" or type(endX) ~=
- "number" or type(endY) ~= "number" or
- (nColour ~= nil and type(nColour) ~= "number") then
- error("Expected startX, startY, endX, endY, colour", 2)
- end
- startX = math.floor(startX)
- startY = math.floor(startY)
- endX = math.floor(endX)
- endY = math.floor(endY)
- if nColour then term.setBackgroundColor(nColour) end
- if startX == endX and startY == endY then
- drawPixelInternal(startX, startY)
- return
- end
- local minX = math.min(startX, endX)
- if minX == startX then
- minY = startY
- maxX = endX
- maxY = endY
- else
- minY = endY
- maxX = startX
- maxY = startY
- end
- for x = minX, maxX do for y = minY, maxY do drawPixelInternal(x, y) end end
- end
- function qlv()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- titolo("Tangara - ACC")
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- local qlv = paintutils.loadImage("qlv")
- paintutils.drawImage(qlv, 2, 1)
- end
- -- Variabili da popolare
- scritte = {}
- scrittepos = {}
- term.setBackgroundColor(colors.white)
- term.clear()
- while true do
- qlv()
- term.setCursorPos(12, 1)
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.white)
- term.write("SCRIVI SCRITTE SUL QLV")
- for k, v in ipairs(scritte) do
- term.setCursorPos(v.x, v.y)
- term.write(v.text)
- end
- local ev, b, x, y = os.pullEvent("mouse_click")
- if y > 18 then
- break
- end
- if scrittepos[x.."_"..y] ~= nil then
- table.remove(scritte, scrittepos[x.."_"..y])
- scrittepos[x.."_"..y] = nil
- else
- term.setCursorPos(x, y)
- local scritta = read()
- if scritta ~= "" and scritta ~= " " then
- table.insert(scritte, {text=scritta,x=x,y=y})
- scrittepos[x.."_"..y] = #scritte
- end
- end
- end
- -- Write
- local h = fs.open("qlvtxt", "w")
- h.write(textutils.serialize(scritte))
- h.close()
- print("DONEEE")
Advertisement
Add Comment
Please, Sign In to add comment