Z1maV1

diamondAPI

Aug 4th, 2022 (edited)
438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.90 KB | None | 0 0
  1. --VARIABLES
  2.  
  3. bgrPath = settings.get("DiamondOS.cfg.bgr", "/diamondOS.beta/bin/desktop/wallpapers/bgr0.nfp")
  4. local hasAdminPermision = false
  5.  
  6. --LOCAL
  7.  
  8. local function finishApp()
  9.     term.setBackgroundColor(colors.black)
  10.     term.setTextColor(colors.white)
  11.     term.clear()
  12.     term.setCursorPos(1,1)
  13.     shell.run("/os/.sys/main")
  14.     --error()
  15. end
  16.  
  17. local function printCetered(y,s,clearLine)
  18.     local x = math.floor((w - string.len(s)) / 2)
  19.     term.setCursorPos(x,y)
  20.     if clearLine == true then
  21.         term.clearLine()
  22.     end
  23.     term.write(s)
  24. end
  25.  
  26. local function drawdesk()
  27.     deskimage = paintutils.loadImage(bgrPath)
  28.     paintutils.drawImage(deskimage, 1, 1)
  29.     drawhotbar()
  30. end
  31.  
  32. local function drawhotbar()
  33.     term.setBackgroundColor(colors.gray)
  34.     term.setCursorPos(1,1)
  35.     term.clearLine()
  36.     --if openedPrograms == true then
  37.     --  print("[Menu]  |  [Close]") -- [CLOSE] 12-18
  38.     --else
  39.     print("[ OS ]")
  40.     --end
  41. end
  42.  
  43. --FUNCTIONS
  44.  
  45. function initWindow(backgroundColor, possibleToClose)
  46.     local x, y = term.getSize()
  47.     term.setBackgroundColor(backgroundColor)
  48.     term.clear()
  49.     term.setCursorPos(x-2,2)
  50.     term.setTextColor(colors.black)
  51.     term.setBackgroundColor(colors.red)
  52.     if possibleToClose == true then
  53.         print("[X]")
  54.     end
  55.     term.setBackgroundColor(backgroundColor)
  56.     drawhotbar()
  57. end
  58. function showDialogWindow(windowName, collection)
  59.  
  60. end
  61. function appClose()
  62.     term.clear()
  63.     drawdesk()
  64. end
  65. function appInit(appName, author, version, path)
  66.     --collection = settings.get("Apps")
  67.     --info = {appName, author, version, path}
  68.     --settings.set("Apps", textutils.serialise({collection, info}, {allow_repetitions = true, compact = true}))
  69.     --settings.save()
  70. end
  71. function accountAskAdminPermission()
  72. end
  73. function dShell_Shutdown()
  74.     if hasAdminPermision == true then
  75.         os.shutdown()
  76.     else
  77.         return false
  78.     end
  79. end
  80. function dShell_Reboot()
  81.     if hasAdminPermision == true then
  82.         os.reboot()
  83.     else
  84.         return false
  85.     end
  86. end
  87.  
  88.  
Advertisement
Add Comment
Please, Sign In to add comment