Advertisement
meuced

Ep21. touchscreens

Apr 8th, 2013
2,968
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.50 KB | None | 0 0
  1. monl = peripheral.wrap("left")
  2. monr = peripheral.wrap("right")
  3.  
  4. x, y = monl.getSize()
  5. print(x.."  "..y)
  6.  
  7. x, y = monr.getSize()
  8.  
  9. while true do
  10. --  event, side, xpos, ypos = os.pullEvent("monitor_touch")
  11.   event, button, xpos, ypos = os.pullEvent("mouse_click")
  12.   paintutils.drawPixel(xpos, ypos, colors.red)
  13.   monr.write("X : "..xpos.." - Y : "..ypos)
  14.   x1, y1 = monr.getCursorPos()
  15.   if y1 == y then
  16.        monr.scroll(1)
  17.        monr.setCursorPos(1,y1)
  18.   else monr.setCursorPos(1,y1+1)
  19.   end
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement