mon = peripheral.wrap("monitor_5")
react = peripheral.wrap("BigReactors-Reactor_0")
monX, monY = mon.getSize()
local function draw_Line(xPos, yPos, color, length)
mon.setCursorPos(xPos, yPos)
mon.setBackgroundColor(color)
mon.write(string.rep(" ", length))
end
local function clear()
mon.setBackgroundColor(colors.black)
mon.clear()
end
local function writeText(xPos, yPos, bg_color, tx_color, text)
mon.setCursorPos(xPos, yPos)
mon.setBackgroundColor(bg_color)
mon.setTextColor(tx_color)
mon.write(text)
end
local function drawMenus(color)
mon.setCursorPos(1, 1)
mon.setBackgroundColor(color)
mon.write(string.rep(" ", monX))
mon.setCursorPos(1, monY)
mon.write(string.rep(" ", monX))
end
local function homescreen(color)
clear()
while true do
energy = react.getEnergyProducedLastTick()
drawMenus(color)
writeText(monX/2-8, 1, color, colors.white, "Reactor Control")
sleep(0.1)
end
end
local function mon_touch()
local event, side, x, y = os.pullEvent("monitor_touch")
if x > 1 then
shell.run("shutdown")
end
sleep(0.1)
end
function call_homepage()
while true do
parallel.waitForAll(homescreen(colors.blue), mon_touch())
sleep(0.1)
end
end
while true do
call_homepage()
sleep(0.1)
end
Comments