Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.find("monitor")
- button = {}
- mon.setTextScale(0.5)
- function createButton(name, func, Xstart, Ystart, Xend, Yend)
- button[name] = {}
- button[name]["func"] = func
- button[name]["active"] = false
- button[name]["Xstart"] = Xstart
- button[name]["Xend"] = Xend
- button[name]["Ystart"] = Ystart
- button[name]["Yend"] = Yend
- end
- function fill(text, color, bName)
- mon.setBackgroundColor(color)
- data = button[bName]
- local yspot = math.floor((data["Ystart"] + data["Yend"])/2)
- local xspot = math.floor((data["Xend"]-data["Xstart"]-#text)/2)+1
- for j = data["Ystart"],data["Yend"] do
- mon.setCursorPos(Xpos, j)
- if j == yspot then
- k = 0
- while k <= data["Xend"] do
- if k == xspot then
- mon.write(text)
- k = k + #text
- else
- mon.write(" ")
- k = k + 1
- end
- end
- else
- for i = data["Xstart"], data["Xend"] do
- mon.write(" ")
- end
- end
- end
- mon.setBackgroundColor(colors.black)
- end
- createButton("lul", test, 5,5,30,10)
- fill("Balloe", colors.pink, "lul")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement