Advertisement
Guest User

lines.lua

a guest
Dec 6th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.18 KB | None | 0 0
  1. function btnCon(pH1,pH2,pW1,pW2,pCMD,pTxt)
  2.     btn={}
  3.     btn.HBounds={H1=pH1,H2=pH2}
  4.     btn.WBounds={W1=pW1,W2=pW2}
  5.     btn.CMD=pCMD
  6.     btn.Txt=pTxt
  7.     btn.Enabled=false
  8.     return btn
  9. end
  10.  
  11. function draw(pHBounds,pWBounds,pText)
  12.     d.setBackgroundColor(colors.red)
  13.    
  14.     for y=pHBounds.H1,pHBounds.H2 do
  15.         for x=pWBounds.W1,pWBounds.W2 do
  16.             d.setCursorPos(x,y)
  17.             if y==pHbounds.H1+2 and x==pWBounds.W1+2 then
  18.                 d.write("pText")
  19.             else
  20.                 d.write(" ")
  21.             end
  22.         end
  23.     end
  24. end
  25.  
  26. function ClearAndReset()
  27.     d.setBackgroundColor(colors.black)
  28.    
  29.     for x=1,39 do
  30.         for y=1,29 do
  31.             d.setCursorPos(x,y)
  32.             d.write(" ")
  33.             end
  34.         end        
  35.     d.clear()        
  36. end    
  37.  
  38. btns={}
  39.  
  40. btns[1]=btnCon(2,6,15,25,"2,F","F")
  41. btns[2]=btnCon(14,18,15,25,"5,B","B")
  42. btns[3]=btnCon(8,12,28,38,"3,R","R")
  43. btns[4]=btnCon(8,12,2,12,"4,L","L")
  44.  
  45. d = peripheral.wrap("top")
  46. d.setCursorPos(1,1)
  47. d.write("1")
  48.  
  49. ClearAndReset()
  50.  
  51. d.write("2")
  52.  
  53. for z=1,4 do
  54.     b=btns[z]
  55.    d.write(b.HBounds.H1.." "..b.HBounds.H2)
  56.    -- draw(b.HBounds,b.WBounds,b.Txt)
  57. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement