Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local rows = {}
- local rowCounter = 0
- os.loadAPI("touchpoint")
- local margin = 2
- local height = 2
- local t = touchpoint.new("top")
- local w, h = term.getSize()
- function addRow(column)
- rows[rowCounter] = column
- rowCounter = rowCounter + 1
- end
- function addButton(label, row, column, width, func, color1, color2)
- marginLeft = column / rows[row] * w + margin
- marginTop = row * height + margin * row + margin
- width = ((width / rows[row]) * (w - (rows[row] + 1) * margin)) + marginLeft
- t:add(label, func, math.floor(marginLeft), math.floor(marginTop),math.floor(width), math.floor(height + marginTop), color1, color2)
- end
- function draw()
- t:draw()
- while true do
- local event, p1 = t:handleEvents(os.pullEvent())
- if event == "button_click" then
- term.clear()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment