From 321ff7737c2da3f71c052323ef74d8d7b10396a2 Mon Sep 17 00:00:00 2001 From: Not Date: Mon, 28 Mar 2022 13:09:52 +0200 Subject: [PATCH] v1.2.3 --- leaderboard.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/leaderboard.lua b/leaderboard.lua index 249ca26..df6858b 100644 --- a/leaderboard.lua +++ b/leaderboard.lua @@ -186,6 +186,17 @@ local function drawitem(v, x, y, scale, itempatch, vflags) ) end +local function marquee(text, maxwidth) + if #text <= maxwidth then + return text + end + + local shift = 16 + local pos = ((leveltime / 16) % (#text - maxwidth + shift * 2)) + 1 - shift + pos = min(max(pos, 1), #text - maxwidth + 1) + return text:sub(pos, pos + maxwidth - 1) +end + local bodium = {V_YELLOWMAP, V_GRAYMAP, V_BROWNMAP, 0} local splitColor = {[true]=V_SKYMAP, [false]=V_REDMAP} local splitSymbol = {[true]="-", [false]="+"} @@ -273,7 +284,7 @@ local function drawScoreboard(v, player) stralign = "small" py = 2 if v.stringWidth(name, 0, "small") > MAXWIDTH then - name = name:sub(0, 15) + "..." + name = marquee(name, 15) end end end