Daniel_I_Am

Nexus Project

Oct 25th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.53 KB | None | 0 0
  1. os = require("os")
  2. io = require("io")
  3. component = require("component")
  4. sides = require("sides")
  5. BA = require("buttonAPI")
  6. colors = require("colors")
  7.  
  8. transposer = component.transposer
  9. gpu = component.gpu
  10.  
  11. gpu.setResolution(gpu.maxResolution())
  12. width,height = gpu.getResolution()
  13. portalSide = sides.north
  14. storageSide = sides.top
  15.  
  16. function checkInventory(side)
  17.     storageSize = transposer.getInventorySize(side)
  18.     contents = {}
  19.     for i=1,storageSize,1 do
  20.         table.insert(contents,transposer.getStackInSlot(side,i))
  21.     end
  22. end
  23.  
  24. function GUI()
  25.    
  26. end
  27. addButtons({a,b,c},2,2,1,5,5,colors.red,colors.white,15,3) -> {{a,b},{c,nil}}
  28. function addButtons(list,gridX,gridY,gridSpacing,xstart,ystart,buttonColor,textColor,buttonWidth,buttonHeight)
  29.     for i=1,#list do
  30.         BA.makeButton(xstart+((buttonWidth+gridSpacing)*((i-i%gridY-1)/gridY)),ystart+((buttonHeight+gridSpacing)*(i%gridY-1)),buttonColor,textColor,-1,-1,tostring(list[i]))
  31.     end
  32. end
  33.  
  34. function addRect(x1,y1,x2,y2,fillColor,borderColor,borderSize)
  35.     gpu.setBackground(borderColor)
  36.     gpu.fill(x1,y1,x2-x1,y2-y1," ")
  37.     gpu.setBackground(fillColor)
  38.     gpu.fill(x1+borderSize,y1+borderSize,x2-x1-borderSize,y2-y1-borderSize," ")
  39. end
  40.  
  41. function addText(x,y,str,textColor,backgroundColor)
  42.     gpu.setForeground(textColor)
  43.     gpu.setBackground(backgroundColor)
  44.     gpu.set(x,y,str)
  45. end
  46.  
  47. function addTextCentered(y,x1,x2,str,textColor,backgroundColor)
  48.     --centeres text between x1 and x2
  49.     xcenter = (x1+x2)/2
  50.     xtext = xcenter-(len(tostring(str))/2)
  51.     addText(xtext,y,str,textColor,backgroundColor)
  52. end
Advertisement
Add Comment
Please, Sign In to add comment