SHOW:
|
|
- or go back to the newest paste.
1 | modem = peripheral.wrap("back") | |
2 | modem.open(12) | |
3 | ||
4 | --# load the touchpoint API | |
5 | os.loadAPI("touchpoint") | |
6 | ||
7 | --# intialize a new button set on the top monitor | |
8 | local t = touchpoint.new("top") | |
9 | ||
10 | --# add two buttons | |
11 | - | t:add("for", nil, 2, 2, 8, 8, colors.red, colors.lime) |
11 | + | t:add("for", nil, 2, 2, 6, 6, colors.red, colors.lime) |
12 | - | t:add("back", nil, 10, 2, 16, 8, colors.red, colors.lime) |
12 | + | t:add("back", nil, 8, 2, 12, 6, colors.red, colors.lime) |
13 | ||
14 | --# draw the buttons | |
15 | t:draw() | |
16 | ||
17 | while true do | |
18 | --#HandleEvents will convert monitor_touch events to button_click if it was on a button | |
19 | local event, p1 = t:handleEvents(os.pullEvent()) | |
20 | - | print(event) |
20 | + | |
21 | - | print(p1) |
21 | + | |
22 | --# toggle the button that was clicked. | |
23 | t:flash(p1) | |
24 | --# and toggle the redstone output on that side. | |
25 | - | print(p1) |
25 | + | |
26 | ||
27 | end | |
28 | end |