support for love-build, fix memory issues. A few bugs to tweak

This commit is contained in:
2026-06-09 22:54:41 -07:00
parent 6b864a2d9b
commit 3109844765
17 changed files with 132 additions and 306 deletions
+50 -45
View File
@@ -28,21 +28,18 @@ local boardLog = log:child("board")
boardLog:debug("Creating resize fonts handler")
local function resizeFonts()
-- Use multi-threading to improve performance
multi:newThread(function()
-- Introduce a small delay to avoid too many iterations at once
thread.skip(2)
-- Iterate over each element in the 'manage' table
for i = 1, #manage do
local elem = manage[i]
thread.skip(2)
-- Iterate over each element in the 'manage' table
for i = 1, #manage do
local elem = manage[i]
-- Check if the current element has a centerFont property
if elem.centerFont then
-- Adjust font size and re-center the text
elem:fitFont(nil, nil, {scale = 2/3})
elem:centerFont()
end
-- Check if the current element has a centerFont property
if elem.centerFont then
-- Adjust font size and re-center the text
elem:fitFont(nil, nil, {scale = 2/3})
elem:centerFont()
end
end)
end
end
gui.Events.OnResized(resizeFonts)
@@ -239,17 +236,12 @@ function Menu(frame, path)
label.color = color.bg
label.textColor = color.status_font
label:setRoundness(20,20,60)
boardUpdater:newThread(function()
local test = function()
return label.text ~= ""
end
while true do
thread.hold(test)
label:centerFont()
label:fitFont(nil, nil, {scale = 2/3})
end
end)
local updateLabel = function()
label:fitFont(nil, nil, {scale = 2/3})
label:centerFont()
end
boardUpdater:newThread(updateLabel)
gui.Events.OnResized(updateLabel)
local data = loader:new(path)
board, question, dailydouble = qframe:newFrame(), qframe:newFrame(), qframe:newImageLabel("assets/images/double.jpg")
@@ -409,7 +401,7 @@ function Menu(frame, path)
boardUpdater:newThread("QuestionUpdater",function()
while true do
template.update(dt)
thread.yield()
thread.sleep(.1)
if self.text == "" then return end
end
end)
@@ -460,19 +452,33 @@ end
function ScoreBoard(frame, x, y, w, h, sx, sy, sw, sh)
-- Colors
local C_BG_PANEL = color.new("#1a1a2e")
local C_BG_HEADER = color.new("#16213e")
local C_ACCENT = color.new("#e94560")
local C_ROW_TOP = color.new("#1c2641")
local C_ROW_NORM = color.new("#121226")
local C_BORDER_TOP = color.new("#323c6e")
local C_BORDER_NRM = color.new("#1c1c37")
local C_BAR_EMPTY = color.new("#232341")
local C_TEXT_MUTED = color.new("#786e96")
local C_WHITE = color.new("#ffffff")
local C_GOLD = color.new("#ffd700")
local C_SILVER = color.new("#C0C0C0")
local C_BRONZE = color.new("#cd7f32")
color.indexColor("scoreboard_panel_bg", "#1a1a2e")
color.indexColor("scoreboard_header_bg", "#16213e")
color.indexColor("scoreboard_accent_color", "#e94560")
color.indexColor("scoreboard_row_top_bg", "#1c2641")
color.indexColor("scoreboard_row_norm_bg", "#121226")
color.indexColor("scoreboard_border_top_color", "#323c6e")
color.indexColor("scoreboard_border_nrm_color", "#1c1c37")
color.indexColor("scoreboard_bar_empty_color", "#232341")
color.indexColor("scoreboard_text_muted_color", "#786e96")
color.indexColor("scoreboard_pure_white", "#ffffff")
color.indexColor("scoreboard_precious_gold", "#ffd700")
color.indexColor("scoreboard_precious_silver", "#C0C0C0")
color.indexColor("scoreboard_precious_bronze", "#cd7f32")
local C_BG_PANEL = color.scoreboard_panel_bg
local C_BG_HEADER = color.scoreboard_header_bg
local C_ACCENT = color.scoreboard_accent_color
local C_ROW_TOP = color.scoreboard_row_top_bg
local C_ROW_NORM = color.scoreboard_row_norm_bg
local C_BORDER_TOP = color.scoreboard_border_top_color
local C_BORDER_NRM = color.scoreboard_border_nrm_color
local C_BAR_EMPTY = color.scoreboard_bar_empty_color
local C_TEXT_MUTED = color.scoreboard_text_muted_color
local C_WHITE = color.scoreboard_pure_white
local C_GOLD = color.scoreboard_precious_gold
local C_SILVER = color.scoreboard_precious_silver
local C_BRONZE = color.scoreboard_precious_bronze
-- Config stuff
local LEADER_HEIGHT_SCALE = .06
@@ -572,14 +578,13 @@ function ScoreBoard(frame, x, y, w, h, sx, sy, sw, sh)
remove_player:setFont(20)
remove_player.align = gui.ALIGN_CENTER
local embededWatch = {remove_player}
scoreUpdater:newThread(function()
while true do
thread.sleep(.01)
for i,v in pairs(embededWatch) do
v:centerFont()
end
gui.Events.OnMousePressed(boardUpdater:newFunction(function()
for i,v in pairs(embededWatch) do
v:centerFont()
v:centerFont()
end
end)
end))
local function embedTextEdit(reference, default, but_text, callback)
reference.color = C_BORDER_NRM