CCCPaste

Dom BRF2

monitor = peripheral.wrap("monitor_1")
function pos(...) return term.setCursorPos(...) end
function cls(...) return term.clear() end
function tCol(...) return term.setTextColor(...) end
function bCol(...) return term.setBackgroundColor(...) end
function box(...) return paintutils.drawFilledBox(...) end
function line(...) return paintutils.drawLine(...) end
function write(...) return term.write(...) end
term.redirect(monitor)
w, h = monitor.getSize()

function getSize() w,h = monitor.getSize() end
tCol(colors.white)
local darkmode = true
local darkmodec

local boolArray = {false,false,false,false,false,false,false,false,false,false,false}

local function brf2()
    monitor.setTextScale(1.5)
    getSize()
    cls()
    if darkmode then darkmodec = colours.black else darkmodec = colours.blue end
    box(1,1,w,h,darkmodec)
    pos(w/2-#"BRF2"/2,1)
    write("BRF2")

    -- left column (6)
    local y=3
    pos(5,y) bCol(darkmodec) write("Shimmer Dust") if boolArray[1]==false then box(23,y,26,y,colors.red) else box(23,y,26,y,colors.lime) end; y=y+2
    pos(5,y) bCol(darkmodec) write("Certus Quartz") if boolArray[2]==false then box(23,y,26,y,colors.red) else box(23,y,26,y,colors.lime) end; y=y+2
    pos(5,y) bCol(darkmodec) write("Certus Quartz Dust") if boolArray[3]==false then box(23,y,26,y,colors.red) else box(23,y,26,y,colors.lime) end; y=y+2
    pos(5,y) bCol(darkmodec) write("Shimmer") if boolArray[4]==false then box(23,y,26,y,colors.red) else box(23,y,26,y,colors.lime) end; y=y+2
    pos(5,y) bCol(darkmodec) write("Amethyst Dust") if boolArray[5]==false then box(23,y,26,y,colors.red) else box(23,y,26,y,colors.lime) end; y=y+2
    pos(5,y) bCol(darkmodec) write("Glow Ink Sac") if boolArray[6]==false then box(23,y,26,y,colors.red) else box(23,y,26,y,colors.lime) end
    pos(5,y2) bCol(darkmodec) write("Ink Sac") if boolArray[7]==false then box(23,y,26,y,colors.red) else box(23,y,26,y,colors.lime) end; y=y+2
    pos(5,y2) bCol(darkmodec) write("Paper") if boolArray[8]==false then box(23,y,26,y,colors.red) else box(23,y,26,y,colors.lime) end; y=y+2
    pos(5,y2) bCol(darkmodec) write("Clay Dust") if boolArray[9]==false then box(23,y,26,y,colors.red) else box(23,y,26,y,colors.lime) end; y=y+2
    -- right column (5)
    local y2=3
    pos(28,y2) bCol(darkmodec) write("Lime Dust") if boolArray[10]==false then box(46,y2,49,y2,colors.red) else box(46,y2,49,y2,colors.lime) end; y2=y2+2
    pos(28,y2) bCol(darkmodec) write("Dried Kelp") if boolArray[11]==false then box(46,y2,49,y2,colors.red) else box(46,y2,49,y2,colors.lime) end

    pos(1,h) bCol(colors.black) write("EXIT")
    while true do
        local event, button, mx, my = os.pullEvent()
        if event == "monitor_touch" then
            if mx >= 1 and mx <= (1+#"EXIT") and my == h then return "menu" end
            local ly=3
            for i=1,6 do if mx>=23 and mx<=26 and my==ly then boolArray[i]=not boolArray[i]; brf2() end; ly=ly+2 end
            local ry=3
            for i=7,11 do if mx>=46 and mx<=49 and my==ry then boolArray[i]=not boolArray[i]; brf2() end; ry=ry+2 end
            if mx >= w/2-#"BRF2"/2 and mx <= w/2+#"BRF2"/2 and my == 1 then darkmode = not darkmode; brf2() end
        end
    end
end

return {brf2 = brf2}