help with scrolling title
Posted: 02 Apr 2016, 12:41
So if you've played BAR you might have noticed the scrolling song titles in the upper right hand corner. Now, I'm looking for a better way to implement them than how it is currently.
As you can see it's quite hacky and horribly inefficient; lua has to create a new string, the length of the string, for every char in the string as it mashes the two halves together.
What I'd like to do is draw the title twice, one slightly after the other and move them slowly to the left while clipping them to within the parent chili window. I feel like this would be easy if I knew anything about drawing fonts but I don't, so any advice?
Code: Select all
local function scrollName()
local length = string.len(trackLabel)
if length > 35 then
if labelVar > length then labelVar = 0 end
songLabel:SetCaption(string.sub(trackLabel, labelVar)..string.sub(trackLabel,0, labelVar-1))
labelVar = labelVar + 1
end
end
What I'd like to do is draw the title twice, one slightly after the other and move them slowly to the left while clipping them to within the parent chili window. I feel like this would be easy if I knew anything about drawing fonts but I don't, so any advice?