Open tonihele opened 8 months ago
The bitmap font/text code is a great example of bad code. It does back flips and hand springs to seemingly avoid creating "garbage"... but then ends up creating hidden garbage instead, being overly complicated, and hurting its own performance. It also confounds usability improvements like easily being able to detect 'clicked character' and stuff like that.
Some of the problems are even more fundamental than what you point out. The whole thing is in need of a rewrite. I started one once but it's a big job.
Minor BitmapFont code architecture issues. Functionally it works just fine :)
arrayBased
. It never uses it, it is always true. Some of these have been deprecated already in the hierarchy, maybe this one should also be. Now it is just confusingpageQuads
isLinkedList
, and the said method heavily usesget(int)
on it. This is not great, n^2 problem, right?get(int)
.LinkedList is probably utilized since its steady
add
performance and that it doesn't leave potentially big arrays behind (if your text goes from being 2,147,483,647 to 1 character... you'll never recover). At least point 2 could be covered by afor each
loop on theLinkedList
and having a manual counter for the index as it is needed elsewhere.