Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Tom API V0.1.0--
- function getVersion(s)
- v = "TomOS_0.1.0"
- return v
- end
- -- GUI Generating function --
- tX, tY = term.getSize()
- function gui()
- term.setTextColor(colors.green)
- term.setBackgroundColour(colours.black)
- term.clear()
- term.setCursorPos(1,1)
- v = tom.getVersion()
- write("+" .. string.rep("-", tX-2) .."+")
- for i = 2, tY -1 do
- term.setCursorPos(1,i)
- write("|")
- term.setCursorPos(tX,i)
- write("|")
- end
- term.setCursorPos(1,tY)
- write("+" .. string.rep("-", tX -2).. "+")
- term.setTextColor(colors.blue)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(tX -( string.len(v)+1),1)
- term.write(v)
- term.setTextColor(colors.green)
- term.setBackgroundColor(colors.black)
- term.setCursorPos(2,2)
- end
- -- Print in centre of screen function --
- function header(s)
- term.setCursorPos(math.ceil(((tX - string.len(s))/2)+1),2)
- term.write(s)
- end
- -- newline fits gui function --
- function newl()
- tx, ty = term.getCursorPos()
- term.setCursorPos(2,ty+1)
- end
- -- Centre text after header --
- function centre(s)
- tx, t = term.getSize()
- t, ty = term.getCursorPos()
- term.setCursorPos(math.ceil(((tx - string.len(s))/2)+1),ty +1)
- term.write(s)
- end
- -- Centre function for menu items --
- function menuc(s)
- mx,my = term.getSize()
- t, my = term.getCursorPos()
- x = (mx/2) - 4
- term.setCursorPos(x,my+1)
- term.write(s)
- end
- -- Find active user name --
- function user()
- file = io.open("/os/.logon","r")
- f = file:read()
- return f
- end
- -- Print a welcome for the user as header --
- function welcome()
- user = tom.user()
- welc = ("Welcome ".. user)
- tom.header(welc)
- end
Add Comment
Please, Sign In to add comment