Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.setCursorPos(1, 1)
- term.setBackgroundColor(colors.white)
- term.clear()
- -- Hack OS - v0.19
- -- By FoxWorn3365
- -- APPUNTI
- -- Configurazioni sistema: .localConf
- -- Configurazioni pubbliche: .publicConf
- -- Immagini: /Hack/images/
- -- APP: /Hack/programmi/
- -- App di esempio:
- -- Directory: /Hack/programmi/fileManager/
- -- Icona: /Hack/programmi/fileManager/app.ico
- -- File da eseguire: /Hack/programmi/fileManager/exec.luaDir
- -- Configurazioni (facoltativo) (OBBLIGO AUTOGENERAZIONE): /Hack/programmi/fileManager/conf.public
- -- Nome dell'APP (massimo 4 caratteri): /Hack/programmi/fileManager/app.name
- -- API: https://fcosma.it/hackos/api
- maxw, maxh = term.getSize()
- 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 giremu(inputstr, sep)
- local t={}
- for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
- table.insert(t, str)
- end
- return t
- end
- function clear()
- sfondo(colors.black)
- term.clear()
- term.setCursorPos(1, 1)
- end
- function clearRed()
- sfondo(colors.red)
- term.clear()
- term.setCursorPos(1, 1)
- end
- function titolo(testo)
- drawFilledBox(1, 1, maxw, 1, colors.red)
- term.setCursorPos((maxw - #testo) / 2, 1)
- term.setTextColor(colors.white)
- term.write(testo)
- end
- function alarm(testo, colore, y)
- drawFilledBox(1, y, maxw, y, colors[colore])
- term.setCursorPos((maxw - #testo) / 2, y)
- term.setTextColor(colors.white)
- term.write(testo)
- no()
- end
- function modi(file, cont)
- local h = fs.open(file, "w")
- h.writeLine(cont)
- h.flush()
- h.close()
- end
- function bottone(color, text, x, y)
- term.setBackgroundColor(colors[color])
- term.setTextColor(colors.white)
- term.setCursorPos(x, y)
- print(text)
- end
- function drawA()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- end
- function ico(x, y, color, text)
- term.setBackgroundColor(colors[color])
- term.setTextColor(colors.white)
- term.setCursorPos(x, y)
- print(text)
- drawA()
- end
- function menu()
- drawA()
- term.clear()
- titolo("Sfondo Manager")
- ico(51, 1, "gray", "X")
- end
- don = 0
- while true do
- if don == 0 then
- menu()
- print("\nSfondi in primo piano:")
- ico(10, 6, "orange", "VISIONE SU PONTE")
- ico(10, 8, "orange", "BANDIERA ARCOBALENO")
- local event, bt, x, y = os.pullEvent("mouse_click")
- if y == 1 and x == 51 then
- shell.run("desktop")
- elseif y == 6 and x > 10 then
- term.setTextColor(colors.green)
- print("Installo lo sfondo in /Hack/files/sfondi/ tra 3 secondi...")
- sleep(2)
- if fs.isDir("/Hack/files/sfondi") ~= true then
- shell.run("mkdir /Hack/files/sfondi")
- end
- shell.run("pastebin get CMVkYgkT /Hack/files/sfondi/sfondo_01")
- print("Installato! Nome file: sfondo_01")
- sleep(0.6)
- shell.run("desktop")
- elseif y == 8 and x > 10 then
- term.setTextColor(colors.green)
- print("Installo lo sfondo in /Hack/files/sfondi/ tra 3 secondi...")
- sleep(2)
- if fs.isDir("/Hack/files/sfondi") ~= true then
- shell.run("mkdir /Hack/files/sfondi")
- end
- shell.run("pastebin get aDViyJQG /Hack/files/sfondi/sfondo_02")
- print("Installato! Nome file: sfondo_02")
- sleep(0.6)
- shell.run("desktop")
- end
- end
- end
Add Comment
Please, Sign In to add comment