mirror of
https://github.com/Kunsi/scheduled-plugin-pretalx-broadcast-tools.git
synced 2024-11-22 01:51:03 +00:00
node.lua: respect "use tracks" setting
This commit is contained in:
parent
60cd315f0b
commit
99624b5d92
1 changed files with 36 additions and 34 deletions
70
node.lua
70
node.lua
|
@ -138,41 +138,43 @@ function node.render()
|
||||||
local track_x = 0
|
local track_x = 0
|
||||||
local track_y = NATIVE_HEIGHT - PADDING*0.3
|
local track_y = NATIVE_HEIGHT - PADDING*0.3
|
||||||
local space_used_for_tracks = 0
|
local space_used_for_tracks = 0
|
||||||
for idx = 1, #tracks do
|
if show_track then
|
||||||
track = tracks[idx]
|
for idx = 1, #tracks do
|
||||||
if track.color ~= json.null then
|
track = tracks[idx]
|
||||||
r,g,b = parse_rgb(track.color)
|
if track.color ~= json.null then
|
||||||
local track_width = font_track:width(track.name, info_size)
|
r,g,b = parse_rgb(track.color)
|
||||||
local brightness = math.max(r, g, b)
|
local track_width = font_track:width(track.name, info_size)
|
||||||
if track_x - track_width < PADDING then
|
local brightness = math.max(r, g, b)
|
||||||
track_x = NATIVE_WIDTH - PADDING
|
if track_x - track_width < PADDING then
|
||||||
track_y = track_y - info_size - PADDING
|
track_x = NATIVE_WIDTH - PADDING
|
||||||
space_used_for_tracks = space_used_for_tracks + 1
|
track_y = track_y - info_size - PADDING
|
||||||
end
|
space_used_for_tracks = space_used_for_tracks + 1
|
||||||
resource.create_colored_texture(r,g,b,1):draw(
|
end
|
||||||
track_x - track_width - PADDING*0.3,
|
resource.create_colored_texture(r,g,b,1):draw(
|
||||||
track_y - PADDING*0.3,
|
track_x - track_width - PADDING*0.3,
|
||||||
track_x + PADDING*0.3,
|
track_y - PADDING*0.3,
|
||||||
track_y + info_size + PADDING*0.3
|
track_x + PADDING*0.3,
|
||||||
)
|
track_y + info_size + PADDING*0.3
|
||||||
if brightness > 0.6 then
|
|
||||||
font_track:write(
|
|
||||||
track_x - track_width,
|
|
||||||
track_y,
|
|
||||||
track.name,
|
|
||||||
info_size,
|
|
||||||
0, 0, 0, 1
|
|
||||||
)
|
|
||||||
else
|
|
||||||
font_track:write(
|
|
||||||
track_x - track_width,
|
|
||||||
track_y,
|
|
||||||
track.name,
|
|
||||||
info_size,
|
|
||||||
1, 1, 1, 1
|
|
||||||
)
|
)
|
||||||
|
if brightness > 0.6 then
|
||||||
|
font_track:write(
|
||||||
|
track_x - track_width,
|
||||||
|
track_y,
|
||||||
|
track.name,
|
||||||
|
info_size,
|
||||||
|
0, 0, 0, 1
|
||||||
|
)
|
||||||
|
else
|
||||||
|
font_track:write(
|
||||||
|
track_x - track_width,
|
||||||
|
track_y,
|
||||||
|
track.name,
|
||||||
|
info_size,
|
||||||
|
1, 1, 1, 1
|
||||||
|
)
|
||||||
|
end
|
||||||
|
track_x = track_x - track_width - PADDING
|
||||||
end
|
end
|
||||||
track_x = track_x - track_width - PADDING
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -229,7 +231,7 @@ function node.render()
|
||||||
font_text:write(col2 - 15 - PADDING - time_width, y, talk_time, time_size, 1, 1, 1, 1)
|
font_text:write(col2 - 15 - PADDING - time_width, y, talk_time, time_size, 1, 1, 1, 1)
|
||||||
|
|
||||||
-- track
|
-- track
|
||||||
if talk.track ~= json.null and talk.track.color ~= json.null then
|
if show_track and talk.track ~= json.null and talk.track.color ~= json.null then
|
||||||
local r,g,b = parse_rgb(talk.track.color)
|
local r,g,b = parse_rgb(talk.track.color)
|
||||||
resource.create_colored_texture(r,g,b,1):draw(col2 - 5 - PADDING, y, col2 - 10, y + #title_lines*TALK_FONT_SIZE + 3 + #info_lines*info_size)
|
resource.create_colored_texture(r,g,b,1):draw(col2 - 5 - PADDING, y, col2 - 10, y + #title_lines*TALK_FONT_SIZE + 3 + #info_lines*info_size)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue