38 lines
885 B
Lua
38 lines
885 B
Lua
util.init_hosted()
|
|
|
|
local json = require "json"
|
|
|
|
local serial = sys.get_env "SERIAL"
|
|
local location = "<please wait>"
|
|
local description = "<please wait>"
|
|
|
|
util.data_mapper{
|
|
["device_info"] = function(info)
|
|
info = json.decode(info)
|
|
location = info.location
|
|
description = info.description
|
|
end
|
|
}
|
|
|
|
gl.setup(NATIVE_WIDTH, NATIVE_HEIGHT)
|
|
|
|
card = resource.load_image("testcard.png")
|
|
font = resource.load_font("vera.ttf")
|
|
|
|
function node.render()
|
|
gl.clear(0,0,0,1)
|
|
|
|
card:draw(0, 0, 1920, 1080)
|
|
|
|
-- upper: 623
|
|
-- lower: 707
|
|
|
|
upper_text = "C3VOC: " .. description
|
|
lower_text = location .. " - Serial " .. serial
|
|
|
|
upper_width = font:width(upper_text, 40)
|
|
font:write(960-(upper_width/2), 631, upper_text, 40, 1,1,1,1)
|
|
|
|
lower_width = font:width(lower_text, 20)
|
|
font:write(960-(lower_width/2), 679, lower_text, 20, 1,1,1,1)
|
|
end
|