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()
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.setCursorPos(1, 1)
local title = "tutel host controller"
local titleStart = (w / 2) - (title:len() / 2)
term.setBackgroundColour(colours.red)
term.setBackgroundColour(colours.lightGray)
term.setTextColour(colours.black)
term.clearLine()
term.setCursorPos(titleStart, 1)
term.write(title)
drawTextCentered("tutel host controller")
end
updateScreen()
while true do
updateScreen()
end