---- Super Security Door, By Gustavo Wizard, @2014
---- This program needs Direwolf20 Button API
---- This program needs 2 monitors (bottom 1x1 and top 3x1) 
---- Plz give credit for me and for the button API author if using this program in any way


os.loadAPI("btn")
m = peripheral.wrap("top")

m.setTextScale(0.5)

while true do
m.setBackgroundColor(colors.black)
m.clear()
m.setCursorPos(6,1)
m.setTextColor(colors.white)
m.write("REFUEL")
term.redirect(m)
paintutils.drawLine(2,3,14,3,colors.orange)
paintutils.drawLine(2,9,14,9,colors.orange)
paintutils.drawLine(2,3,2,9,colors.orange)
paintutils.drawLine(14,3,14,9,colors.orange)
m.setBackgroundColor(colors.yellow)
m.setTextColor(colors.white)

function fillTable()
 btn.setTable("OPEN", on, 4,12,5,5)
 btn.setTable("CLOSE", off, 4,12,7,7)
 btn.screen()
end

function getClick()
 event,side,x,y = os.pullEvent("monitor_touch")
 btn.checkxy(x,y)
end

function on()
 btn.flash("OPEN")
 rs.setOutput("front", true)
end

function off()
 btn.flash("CLOSE")
 rs.setOutput("front", false)
end

fillTable()

getClick()

end

