This commit is contained in:
2024-02-22 21:52:11 +01:00
parent 462907003b
commit 44a080a9a4
3 changed files with 18 additions and 15 deletions

View File

@@ -110,6 +110,15 @@ function getTotal()
end
function drawDesktop()
local halfWidth = newW / 2
drawLine(halfWidth, 3, 1, 40, 0xffffff)
drawLine(1, 43, newW, 1, 0xffffff)
gpu.set(1, 42, "Speicherzellen")
gpu.set(halfWidth + 1, 42, "Generatoren")
gpu.set((newW - #frameTitle) / 2, 1, frameTitle)
end
local splashText = "Supercoole Stromanzeige"
local frameTitle = "Power Monitor - Klicken zum Beenden"
@@ -117,9 +126,7 @@ clearScreen()
drawLine(1, 1, newW, 1, 0xbbbbbb)
gpu.set((newW - #splashText) / 2, 24, splashText)
os.sleep(1)
clearScreen()
gpu.set((newW - #frameTitle) / 2, 1, frameTitle)
local cellsID = getCells()
while true do
@@ -127,12 +134,6 @@ while true do
local count = 0
if x and y then goto quit end
local halfWidth = newW / 2
drawLine(halfWidth, 3, 1, 40, 0xffffff)
drawLine(1, 43, newW, 1, 0xffffff)
gpu.set(1, 42, "Speicherzellen")
gpu.set(halfWidth + 1, 42, "Generatoren")
for address, name in pairs(cellsID) do
local cell = component.proxy( address )
count = count + 1
@@ -147,4 +148,5 @@ end
::quit::
gpu.setResolution( oldW, oldH )
clearScreen()
clearScreen()
print("Programm beendet.")