Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local text
- term.clear()
- local row1 = {"Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P"}
- local row2 = {"A", "S", "D", "F", "G", "H", "J", "K", "L"}
- local row3 = {"Z", "X", "C", "V", "B", "N", "M"}
- local top = 10
- local left = 14
- function printKeyboard()
- top = 10
- for i=0, 10 do
- term.setCursorPos(left + i * 2, top)
- print(row1[i])
- end
- top = top + 2
- for i=0, 9 do
- term.setCursorPos(left + 1 + i * 2, top)
- print(row2[i])
- end
- top = top + 2
- for i=0, 7 do
- term.setCursorPos(left + 3 + i * 2, top)
- print(row3[i])
- end
- end
- while true do
- -- term.clear()
- printKeyboard()
- event, side, xPos, yPos = os.pullEvent("monitor_touch")
- print(xPos .. yPos)
- -- if yPos == top or yPos == top + 2 or yPos == top + 4 then
- -- local key = 0
- -- if yPos == 10 then key = row1[(xPos - left) * 2] end
- -- if yPos == 12 then key = row2[(xPos - left + 1) * 2] end
- -- if yPos == 14 then key = row3[(xPos - left + 3) * 2] end
- -- term.setCursorPos(2, 2)
- -- if key ~= 0 then
- -- text = text .. key
- -- print(text)
- -- end
- end
- sleep(3)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement