Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Lithium OS Compatibility API by LegoStax
- ]]--
- function registerIcon( name, programdir, newx, newy )
- if fs.exists(".programs/icons/iconlist") then
- local file = fs.open(".programs/icons/iconlist", "r")
- icons = textutils.unserialize(file.readAll())
- file.close()
- else
- icons = {}
- end
- icon = {
- txt = name,
- dir = programdir,
- x = tonumber(newx),
- y = tonumber(newy)
- }
- icons[#icons + 1] = icon
- local file = fs.open(".programs/icons/iconlist", "w")
- file.write(texutils.serialize(icons))
- file.close()
- return true
- end
- function getIconList()
- icons = {}
- if fs.exists(".programs/icons/iconlist") then
- local file = fs.open(".programs/icons/iconlist", "r")
- icons = textutils.unserialize(file.readAll())
- file.close()
- end
- return icons
- end
- function drawIcon( icondirect, x, y )
- term.setCursorPos( x, y )
- img = paintutils.loadImage( ".programs/icons/"..icondirect )
- paintutils.drawImage( img, x, y )
- end
- function returnToLith()
- if fs.exists("lithos") then shell.run("lithos")
- else return end
- end
- function alert( title, alerttext, x, y )
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.blue)
- spaces = #alerttext - #title
- term.setCursorPos(x,y)
- term.write(" "..title)
- start = #title + 2
- for i = start,spaces do
- term.setCursorPos(i,y)
- term.write(" ")
- end
- term.setBackgroundColor(colors.red)
- x2 = #title + 3
- term.setCursorPos(x2,y)
- term.write("X")
- term.setTextColor(colors.lightGray)
- term.setBackgroundColor(colors.lightGray)
- term.setCursorPos(x,y+1)
- term.write(" "..alerttext.." ")
- term.setTextColor(colors.black)
- term.setCursorPos(x,y+2)
- term.write(" "..alerttext.." ")
- term.setTextColor(colors.lightGray)
- term.setCursorPos(x,y+3)
- term.write(" "..alerttext.." ")
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- print(spaces)
- print(start)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement