change text locations
This commit is contained in:
parent
c48c01f575
commit
de54b81cff
59
node.lua
59
node.lua
|
@ -50,48 +50,37 @@ function node.render()
|
||||||
lower_width = font:width(lower_text, 20)
|
lower_width = font:width(lower_text, 20)
|
||||||
font:write(960-(lower_width/2), 679, lower_text, 20, 1,1,1,1)
|
font:write(960-(lower_width/2), 679, lower_text, 20, 1,1,1,1)
|
||||||
|
|
||||||
-- TODO
|
-- available space y: 400 to 700
|
||||||
local size, k_x, v_x, y
|
-- left x: 50
|
||||||
|
-- right x: TODO
|
||||||
size = math.floor(HEIGHT/20)
|
local size = 40
|
||||||
y = 30+size*6
|
local x_left = 50
|
||||||
k_x, v_x = 30, 30+font:width("XXXXXXXXXXXXXXXX", size)
|
local x_right = 1000
|
||||||
|
|
||||||
local function key(str)
|
|
||||||
font:write(k_x, y, str, size, 1,1,1,.5)
|
|
||||||
end
|
|
||||||
local function val(str, col)
|
|
||||||
col = col or {1,1,1,.5}
|
|
||||||
font:write(v_x, y, str, size, unpack(col))
|
|
||||||
y = y + size*1.1
|
|
||||||
end
|
|
||||||
|
|
||||||
|
-- left side: network config, online status
|
||||||
if v.network then
|
if v.network then
|
||||||
key "Network config"
|
font:write(50, 400, "Mode: " .. v.network, size, 1,1,1,1)
|
||||||
val(v.network)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if v.ethip then
|
|
||||||
key "Ethernet IPv4"
|
|
||||||
val(v.ethip)
|
|
||||||
end
|
|
||||||
|
|
||||||
if v.wlanip then
|
|
||||||
key "WiFi IPv4"
|
|
||||||
val(v.wlanip)
|
|
||||||
end
|
|
||||||
|
|
||||||
if v.gw then
|
|
||||||
key "Gateway"
|
|
||||||
val(v.gw)
|
|
||||||
end
|
|
||||||
|
|
||||||
if v.online then
|
if v.online then
|
||||||
key "Online status"
|
|
||||||
local col = {1,0,0,1}
|
local col = {1,0,0,1}
|
||||||
if v.online == "online" then
|
if v.online == "online" then
|
||||||
col = {0,1,0,1}
|
col = {0,1,0,1}
|
||||||
end
|
end
|
||||||
val(v.online, col)
|
font:write(50, 450, v.online, size, col)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- right side: IP address
|
||||||
|
if v.ethip then
|
||||||
|
font:write(1000, 400, "Eth IPv4: " .. v.ethip, size, 1,1,1,1)
|
||||||
|
end
|
||||||
|
|
||||||
|
if v.wlanip then
|
||||||
|
font:write(1000, 450, "WiFi IPv4: " .. v.wlanip, size, 1,1,1,1)
|
||||||
|
end
|
||||||
|
|
||||||
|
if v.gw then
|
||||||
|
font:write(1000, 500, "Gateway: " .. v.gw, size, 1,1,1,1)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue