Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("touch");
- mon = peripheral.wrap("front");
- local t1 = touch.new("front");
- local t = t1;
- function writeButtons()
- t1:add("Cell 1", nil, 1, 1, 9, 2, colors.red, colors.lime);
- t1:add("Cell 2", nil, 11, 1, 19, 2, colors.red, colors.lime);
- t1:add("Cell 3", nil, 21, 1, 29, 2, colors.red, colors.lime);
- t1:add("Cell 4", nil, 1, 4, 9, 5, colors.red, colors.lime);
- t1:add("Cell 5", nil, 11, 4, 19, 5, colors.red, colors.lime);
- t1:add("Cell 6", nil, 21, 4, 29, 5, colors.red, colors.lime);
- t1:add("Cell 7", nil, 1, 6, 9, 7, colors.red, colors.lime);
- t1:add("Cell 8", nil, 11, 6, 19, 7, colors.red, colors.lime);
- t1:add("Cell 9", nil, 21, 6, 29, 7, colors.red, colors.lime);
- t1:add("Cell 10", nil, 1, 9, 9, 10, colors.red, colors.lime);
- t1:add("Cell 11", nil, 11, 9, 19, 10, colors.red, colors.lime);
- t1:add("Cell 12", nil, 21, 9, 29, 10, colors.red, colors.lime);
- t = t1;
- t:draw();
- end
- writeButtons();
- while true do
- local event, p1 = t:handleEvents(os.pullEvent());
- if(event == "button_click") then
- t:toggleButton(p1);
- print(p1);
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement