Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function setTable(name, text, xmin, ymin, width, height, onFreq, offFreq, bcolor, tcolor)
- button[name] = {}
- button[name]["text"] = text
- button[name]["active"] = false
- button[name]["xmin"] = xmin
- button[name]["ymin"] = ymin
- button[name]["width"] = width
- button[name]["height"] = height
- button[name]["onFreq"] = onFreq
- button[name]["offFreq"] = offFreq
- button[name]["bcolor"] = bcolor
- button[name]["tcolor"] = tcolor
- end
- function toggleButton(name)
- button[name]["active"] = not button[name]["active"]
- end
- function drawButton(x, y, width, height, bcolor, tcolor, text)
- m.setBackgroundColor(bcolor)
- --Draw the background
- for i=1,height do
- m.setCursorPos(x,y+i-1)
- m.write(string.rep(" ", width))
- end
- -- m.setBackgroundColor(colors.black)
- --Write the text
- m.setTextColor(tcolor)
- local textX = x + math.floor(width/2 - string.len(text)/2)
- local textY = y + math.floor(height/2)
- m.setCursorPos(textX, textY)
- m.write(text)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement