mirror of
https://github.com/Kunsi/scheduled-plugin-pretalx-broadcast-tools.git
synced 2024-11-22 01:51:03 +00:00
add font for track name display
This commit is contained in:
parent
3b845964e7
commit
03a337c352
3 changed files with 14 additions and 6 deletions
10
node.json
10
node.json
|
@ -7,13 +7,13 @@
|
||||||
"title": "Fonts",
|
"title": "Fonts",
|
||||||
"type": "section"
|
"type": "section"
|
||||||
}, {
|
}, {
|
||||||
"title": "Room name",
|
"title": "Room Name",
|
||||||
"ui_width": 6,
|
"ui_width": 6,
|
||||||
"name": "font_room",
|
"name": "font_room",
|
||||||
"type": "font",
|
"type": "font",
|
||||||
"default": "silkscreen.ttf"
|
"default": "silkscreen.ttf"
|
||||||
}, {
|
}, {
|
||||||
"title": "Talk title",
|
"title": "Talk Title",
|
||||||
"ui_width": 6,
|
"ui_width": 6,
|
||||||
"name": "font_talk",
|
"name": "font_talk",
|
||||||
"type": "font",
|
"type": "font",
|
||||||
|
@ -30,6 +30,12 @@
|
||||||
"name": "font_clock",
|
"name": "font_clock",
|
||||||
"type": "font",
|
"type": "font",
|
||||||
"default": "silkscreen.ttf"
|
"default": "silkscreen.ttf"
|
||||||
|
}, {
|
||||||
|
"title": "Track Name",
|
||||||
|
"ui_width": 6,
|
||||||
|
"name": "font_track",
|
||||||
|
"type": "font",
|
||||||
|
"default": "silkscreen.ttf"
|
||||||
}, {
|
}, {
|
||||||
"title": "all other text",
|
"title": "all other text",
|
||||||
"ui_width": 6,
|
"ui_width": 6,
|
||||||
|
|
7
node.lua
7
node.lua
|
@ -43,6 +43,7 @@ util.file_watch("config.json", function(content)
|
||||||
font_room = resource.load_font(config.font_room.asset_name)
|
font_room = resource.load_font(config.font_room.asset_name)
|
||||||
font_talk = resource.load_font(config.font_talk.asset_name)
|
font_talk = resource.load_font(config.font_talk.asset_name)
|
||||||
font_text = resource.load_font(config.font_text.asset_name)
|
font_text = resource.load_font(config.font_text.asset_name)
|
||||||
|
font_track = resource.load_font(config.font_track.asset_name)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
util.data_mapper{
|
util.data_mapper{
|
||||||
|
@ -138,7 +139,7 @@ function node.render()
|
||||||
track = tracks[idx]
|
track = tracks[idx]
|
||||||
if track.color ~= json.null then
|
if track.color ~= json.null then
|
||||||
r,g,b = parse_rgb(track.color)
|
r,g,b = parse_rgb(track.color)
|
||||||
local track_width = font_talk:width(track.name, info_size)
|
local track_width = font_track:width(track.name, info_size)
|
||||||
local brightness = math.max(r, g, b)
|
local brightness = math.max(r, g, b)
|
||||||
if track_x - track_width < PADDING then
|
if track_x - track_width < PADDING then
|
||||||
track_x = NATIVE_WIDTH - PADDING
|
track_x = NATIVE_WIDTH - PADDING
|
||||||
|
@ -152,7 +153,7 @@ function node.render()
|
||||||
track_y + info_size + PADDING*0.3
|
track_y + info_size + PADDING*0.3
|
||||||
)
|
)
|
||||||
if brightness > 0.6 then
|
if brightness > 0.6 then
|
||||||
font_talk:write(
|
font_track:write(
|
||||||
track_x - track_width,
|
track_x - track_width,
|
||||||
track_y,
|
track_y,
|
||||||
track.name,
|
track.name,
|
||||||
|
@ -160,7 +161,7 @@ function node.render()
|
||||||
0, 0, 0, 1
|
0, 0, 0, 1
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
font_talk:write(
|
font_track:write(
|
||||||
track_x - track_width,
|
track_x - track_width,
|
||||||
track_y,
|
track_y,
|
||||||
track.name,
|
track.name,
|
||||||
|
|
3
tile.lua
3
tile.lua
|
@ -56,6 +56,7 @@ function M.updated_config_json(config)
|
||||||
font_room = resource.load_font(api.localized(config.font_room.asset_name))
|
font_room = resource.load_font(api.localized(config.font_room.asset_name))
|
||||||
font_talk = resource.load_font(api.localized(config.font_talk.asset_name))
|
font_talk = resource.load_font(api.localized(config.font_talk.asset_name))
|
||||||
font_text = resource.load_font(api.localized(config.font_text.asset_name))
|
font_text = resource.load_font(api.localized(config.font_text.asset_name))
|
||||||
|
font_track = resource.load_font(api.localized(config.font_track.asset_name))
|
||||||
|
|
||||||
current_room = nil
|
current_room = nil
|
||||||
for idx, room in ipairs(config.rooms) do
|
for idx, room in ipairs(config.rooms) do
|
||||||
|
@ -228,7 +229,7 @@ local function view_next_talk(starts, ends, config, x1, y1, x2, y2)
|
||||||
end
|
end
|
||||||
if track_text then
|
if track_text then
|
||||||
if a.height > y + 20 + track_size then
|
if a.height > y + 20 + track_size then
|
||||||
text(font_text, col2, y+20, current_talk.track.name, track_size, r,g,b,1)
|
text(font_track, col2, y+20, current_talk.track.name, track_size, r,g,b,1)
|
||||||
end
|
end
|
||||||
elseif current_talk.track.color ~= json.null then
|
elseif current_talk.track.color ~= json.null then
|
||||||
a.add(anims.moving_image_raw(
|
a.add(anims.moving_image_raw(
|
||||||
|
|
Loading…
Reference in a new issue