Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Calafrica Group System
- -- Dione approva
- local monitor = peripheral.wrap( "left" )
- local maxw, maxh = term.getSize()
- -- IMPLEMENTAZIONE DEL DRAWFILLEDBOX
- local function drawPixelInternal(xPos, yPos)
- monitor.setCursorPos(xPos, yPos)
- monitor.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) monitor.setTextColor(nome) end
- function sfondo(nome) monitor.setBackgroundColor(nome) end
- function fineColore() monitor.setTextColour(colours.white) end
- function fineSfondo() monitor.setBackgroundColour(colours.black) end
- function clear()
- sfondo(colors.blue)
- monitor.clear()
- monitor.setCursorPos(1, 1)
- end
- function errore(errore)
- sfondo(colors.red)
- colore(colors.white)
- monitor.clear()
- monitor.setCursorPos(1, 1)
- titolo("Errore irreversibile")
- monitor.setCursorPos(1, 3)
- sfondo(colors.red)
- colore(colors.white)
- monitor.write(errore)
- monitor.write("\n\n\nAttendere qualche secondo...")
- os.sleep(5)
- os.reboot()
- end
- sfondo(colors.cyan)
- titolo("Monitor Gestione EPCO")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement