LDShadowLord

QuickAPI

Feb 25th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. --Define Variables
  2. local component = require("component") --Require/Load Component API
  3. local unicode = require("unicode") --Require/Load Unicode API
  4. local gpu = component.gpu --Assign "gpu" as the handle for the gpu
  5. local wres,hres = component.gpu.getResolution() --Assign wres,hres to the current width and height of the display.
  6.  
  7. --setPixel - Sets a pixel to a specific colour, and sets text
  8. function setPixel(xpos,ypos,color,letter)
  9.   if unicode.len(letter) <= 1 then
  10.     gpu.setBackground(color)
  11.     gpu.set(xpos,ypos,letter)
  12.     gpu.setBackground(0x000000)
  13.   else
  14.     error("Too Long")
  15.   end
  16. end
  17.  
  18. --drawBar - Draws bar across the screen at the specified height
  19. function drawBar(ypos,color)
  20.   for i=1,wres do
  21.     setPixel(i,ypos,color," ")
  22.   end
  23. end
  24.  
  25.  
  26. --Script, Not API Function
  27. drawBar(1,0x666666)
  28. gpu.setForeground(0xff3300)
  29. setPixel(wres-1,1,0x666666,)
  30. gpu.setForeground(0xff9933)
  31. setPixel(wres-3,1,0x666666,)
  32. gpu.setForeground(0xffffff)
Advertisement
Add Comment
Please, Sign In to add comment