Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local maxw, maxh = term.getSize()
- -- IMPLEMENTAZIONE DEL DRAWFILLEDBOX
- 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 colore(nome) term.setTextColor(nome) end
- function sfondo(nome) term.setBackgroundColor(nome) end
- function fineColore() term.setTextColour(colours.white) end
- function fineSfondo() term.setBackgroundColour(colours.black) end
- function titolo(testo)
- drawFilledBox(1, 1, maxw, 1, colors.yellow)
- term.setCursorPos((maxw - #testo) / 2, 1)
- colore(colors.black)
- term.write(testo)
- sfondo(colors.blue)
- end
- function clear()
- sfondo(colors.blue)
- term.clear()
- term.setCursorPos(1, 1)
- end
- function errore(errore)
- sfondo(colors.red)
- colore(colors.white)
- term.clear()
- term.setCursorPos(1, 1)
- titolo("Errore irreversibile")
- term.setCursorPos(1, 3)
- sfondo(colors.red)
- colore(colors.white)
- print(errore)
- print("\n\n\nAttendere qualche secondo...")
- os.sleep(5)
- os.reboot()
- end
- sfondo(colors.white)
- term.clear()
- term.setCursorPos(1, 1)
- colore(colors.white)
- colore(colors.black)
- sfondo(colors.white)
- term.setCursorPos(14, 1)
- term.write("Registrazione partita IVA")
- colore(colors.white)
- sfondo(colors.lime)
- term.setCursorPos(25, 10)
- term.write("Registra una")
- term.setCursorPos(25, 11)
- term.write("partita")
- term.setCursorPos(25, 12)
- term.write("IVA")
- while true do
- local event, par1, par2, par3 = os.pullEvent("mouse_click")
- if par2 >= 25 and par2 <= 37 and par3 >= 10 and par3 <= 12 then
- sfondo(colours.blue)
- term.clear()
- term.setCursorPos(1, 1)
- titolo("Registrazione Partita IVA")
- sfondo(colours.blue)
- colore(colors.white)
- print("\n\nInserire i propri dati. Premere Enter per confermare i dati inseriti.")
- term.setCursorPos(1,9)
- term.write("Intestazione PIVA: ")
- intestazione = read()
- term.setCursorPos(1,11)
- term.write("Nome Intestatario: ")
- nome = read()
- term.setCursorPos(1,13)
- term.write("Sede Legale: ")
- pos = read()
- term.setCursorPos(1,15)
- term.write("Data di apertura: ")
- data = read()
- end
- sleep(0.1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement