Posted 19 January 2014 - 07:32 PM
I am in the process of creating a nifty GUI, and it (of course) uses buttons. I created a function which draws buttons:
function button(cap, xpos, ypos, sizex, sizey)
term.setTextColor(colors.white)
term.setBackgroundColor(colors.blue)
caplen = string.len(cap)
term.setCursorPos(xpos, ypos)
for ydraw = 1, sizey do
for xdraw = 1, sizex do
term.write(" ")
end
term.setCursorPos(xpos, ypos + ydraw)
end
term.setCursorPos((sizex/2-caplen/2)+xpos, sizey/2+ypos)
term.write(cap)
end
Now I have absolutely no idea how to get these buttons to do anything and I need help. -Lenny