View difference between Paste ID: 87KTYP91 and 9v0wUAB3
SHOW: | | - or go back to the newest paste.
1
foundMonitor = false
2
mw, mh = 0
3
spawners = {}
4
spawners[0] = false
5
spawners[1] = true
6
red = 16384
7
green = 32
8
function drawBox(x,y,w,h,c)
9
	i, j = 0;
10
	for i = x, w do
11
		for j = y, h do
12
			paintutils.drawPixel(i,j,c)
13
		end
14
	end
15
end
16
function drawGUI()
17
	mon.clear()
18
	mon.setCursorPos(1,1)
19
	if spawners[0] == true then
20-
		drawBox(mw - mw/2, mh - mh/2, 5,2, green)
20+
		drawBox(mw - mw/2, mh - mh/2, 5,2, 32)
21
	else 
22-
		drawBox(mw - mw/2, mh - mh/2, 5,2, red)
22+
		drawBox(mw - mw/2, mh - mh/2, 5,2, 2)
23
	end
24
	if spawners[1] == true then
25-
		drawBox(mw - mw/2, mh + mh/2, 5,2, green)
25+
		drawBox(mw - mw/2, mh + mh/2, 5,2, 32)
26
	else 
27-
		drawBox(mw - mw/2, mh + mh/2, 5,2, red)
27+
		drawBox(mw - mw/2, mh + mh/2, 5,2, 2)
28
	end
29
end
30
function update()
31
print("updating...")
32
end
33
34
function init()
35
if peripheral.isPresent("top") then	
36
	mon = peripheral.wrap("top")
37
	mw, mh = mon.getSize()
38
	term.redirect(mon)
39
	foundMonitor = true
40
else
41
	foundMonitor = false
42
	print("Monitor not found - Aborting")
43
end
44
if foundMonitor == true then
45
	while true do 
46
		update()
47
		drawGUI()
48
		sleep(1)
49
	end
50
end
51
end
52
53
init()