From 03a337c352b63703fc3cdc08f630fe365efd8788 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Tue, 26 Dec 2023 13:01:38 +0100 Subject: [PATCH] add font for track name display --- node.json | 10 ++++++++-- node.lua | 7 ++++--- tile.lua | 3 ++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/node.json b/node.json index e875666..22188bb 100644 --- a/node.json +++ b/node.json @@ -7,13 +7,13 @@ "title": "Fonts", "type": "section" }, { - "title": "Room name", + "title": "Room Name", "ui_width": 6, "name": "font_room", "type": "font", "default": "silkscreen.ttf" }, { - "title": "Talk title", + "title": "Talk Title", "ui_width": 6, "name": "font_talk", "type": "font", @@ -30,6 +30,12 @@ "name": "font_clock", "type": "font", "default": "silkscreen.ttf" + }, { + "title": "Track Name", + "ui_width": 6, + "name": "font_track", + "type": "font", + "default": "silkscreen.ttf" }, { "title": "all other text", "ui_width": 6, diff --git a/node.lua b/node.lua index a5aefc7..a379652 100644 --- a/node.lua +++ b/node.lua @@ -43,6 +43,7 @@ util.file_watch("config.json", function(content) font_room = resource.load_font(config.font_room.asset_name) font_talk = resource.load_font(config.font_talk.asset_name) font_text = resource.load_font(config.font_text.asset_name) + font_track = resource.load_font(config.font_track.asset_name) end) util.data_mapper{ @@ -138,7 +139,7 @@ function node.render() track = tracks[idx] if track.color ~= json.null then 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) if track_x - track_width < PADDING then track_x = NATIVE_WIDTH - PADDING @@ -152,7 +153,7 @@ function node.render() track_y + info_size + PADDING*0.3 ) if brightness > 0.6 then - font_talk:write( + font_track:write( track_x - track_width, track_y, track.name, @@ -160,7 +161,7 @@ function node.render() 0, 0, 0, 1 ) else - font_talk:write( + font_track:write( track_x - track_width, track_y, track.name, diff --git a/tile.lua b/tile.lua index b6f7d41..0a464dd 100644 --- a/tile.lua +++ b/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_talk = resource.load_font(api.localized(config.font_talk.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 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 if track_text 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 elseif current_talk.track.color ~= json.null then a.add(anims.moving_image_raw(