fix: move centered drawing to func

This commit is contained in:
2025-05-06 18:30:02 -03:00
parent 04e65468c7
commit cf9cb99721
+13 -6
View File
@@ -185,15 +185,22 @@ log.info("broadcasted scan message")
function updateScreen() function updateScreen()
local w, h = term.getSize() local w, h = term.getSize()
local function drawTextCentered(text)
local x = (w / 2) - (text:len() / 2)
local curX, curY = term.getCursorPos()
term.setCursorPos(x, curY)
term.write(text)
end
term.clear() term.clear()
term.setCursorPos(1, 1) term.setCursorPos(1, 1)
local title = "tutel host controller" term.setBackgroundColour(colours.lightGray)
local titleStart = (w / 2) - (title:len() / 2) term.setTextColour(colours.black)
term.setBackgroundColour(colours.red)
term.clearLine() term.clearLine()
term.setCursorPos(titleStart, 1) drawTextCentered("tutel host controller")
term.write(title)
end end
updateScreen() while true do
updateScreen()
end