fix: move centered drawing to func
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
|
while true do
|
||||||
updateScreen()
|
updateScreen()
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user