-
Notifications
You must be signed in to change notification settings - Fork 0
/
storageMonitor.lua
59 lines (53 loc) · 1.59 KB
/
storageMonitor.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
function prepareMon()
mon.clear()
monX, monY = mon.getSize()
if monX < 38 or monY < 25 then
error("Monitor is too small, we need a size of 39x and 26y minimum.")
end
mon.setBackgroundColor(colors.black)
mon.setCursorPos((monX/2)-(#label/2),1)
mon.setTextScale(1)
mon.write(label)
mon.setCursorPos(1,1)
drawBox(2, monX - 1, 3, monY - 10, "CPU's", colors.gray, colors.lightGray)
drawBox(2, monX - 1, monY - 8, monY - 1, "Stats", colors.gray, colors.lightGray)
addBars()
end
function drawBox(xMin, xMax, yMin, yMax, title, bcolor, tcolor)
mon.setBackgroundColor(bcolor)
for xPos = xMin, xMax, 1 do
mon.setCursorPos(xPos, yMin)
mon.write(" ")
end
for yPos = yMin, yMax, 1 do
mon.setCursorPos(xMin, yPos)
mon.write(" ")
mon.setCursorPos(xMax, yPos)
mon.write(" ")
end
for xPos = xMin, xMax, 1 do
mon.setCursorPos(xPos, yMax)
mon.write(" ")
end
mon.setCursorPos(xMin+2, yMin)
mon.setBackgroundColor(colors.black)
mon.setTextColor(tcolor)
mon.write(" ")
mon.write(title)
mon.write(" ")
mon.setTextColor(colors.white)
end
function clear(xMin,xMax, yMin, yMax)
mon.setBackgroundColor(colors.black)
for xPos = xMin, xMax, 1 do
for yPos = yMin, yMax, 1 do
mon.setCursorPos(xPos, yPos)
mon.write(" ")
end
end
end
prepareMon()
while true do
drawBox(2, monX - 1, 3, monY - 10, "CPU's", colors.gray, colors.lightGray)
drawBox(2, monX - 1, monY - 8, monY - 1, "Stats", colors.gray, colors.lightGray)
end