Advertisement
100Toby1

Untitled

Oct 7th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. local text
  2.  
  3. term.clear()
  4.  
  5. local row1 = {"Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P"}
  6. local row2 = {"A", "S", "D", "F", "G", "H", "J", "K", "L"}
  7. local row3 = {"Z", "X", "C", "V", "B", "N", "M"}
  8.  
  9. local top = 10
  10. local left = 14
  11.  
  12. function printKeyboard()
  13. top = 10
  14.  
  15. for i=0, 10 do
  16. term.setCursorPos(left + i * 2, top)
  17. print(row1[i])
  18. end
  19.  
  20. top = top + 2
  21.  
  22. for i=0, 9 do
  23. term.setCursorPos(left + 1 + i * 2, top)
  24. print(row2[i])
  25. end
  26.  
  27. top = top + 2
  28.  
  29. for i=0, 7 do
  30. term.setCursorPos(left + 3 + i * 2, top)
  31. print(row3[i])
  32. end
  33. end
  34.  
  35. while true do
  36. -- term.clear()
  37. printKeyboard()
  38.  
  39. event, side, xPos, yPos = os.pullEvent("monitor_touch")
  40.  
  41. print(xPos .. yPos)
  42.  
  43. -- if yPos == top or yPos == top + 2 or yPos == top + 4 then
  44. -- local key = 0
  45. -- if yPos == 10 then key = row1[(xPos - left) * 2] end
  46. -- if yPos == 12 then key = row2[(xPos - left + 1) * 2] end
  47. -- if yPos == 14 then key = row3[(xPos - left + 3) * 2] end
  48.  
  49. -- term.setCursorPos(2, 2)
  50. -- if key ~= 0 then
  51. -- text = text .. key
  52. -- print(text)
  53. -- end
  54. end
  55.  
  56. sleep(3)
  57. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement