View difference between Paste ID: mVJm39wf and ppssLCm4
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
	if spawners[0] == true then
18
		drawBox(mw - mw/2, mh - mh/2, 5,2, green)
19
	else 
20
		drawBox(mw - mw/2, mh - mh/2, 5,2, red)
21
	end
22
	if spawners[1] == true then
23
		drawBox(mw - mw/2, mh + mh/2, 5,2, green)
24
	else 
25
		drawBox(mw - mw/2, mh + mh/2, 5,2, red)
26
	end
27
end
28
function update()
29
30
end
31
32
function init()
33
if peripheral.isPresent("top") then	
34
	mon = peripheral.wrap("top")
35
	mw, mh = mon.getSize()
36
	foundMonitor = true
37
else
38
	foundMonitor = false
39
	print("Monitor not found - Aborting")
40
end
41
if foundMonitor == true then
42
	while true do 
43
		term.redirect(mon)
44
		mon.clear()
45
		mon.setCursorPos(1,1)
46
		update()
47-
		term.restore()
47+
48
		sleep(1)
49
	end
50
end
51
end
52
53
init()