Skip to content

Many a fix to colored string rendering.

Alex Ksandra requested to merge 0player/t-engine4:colored_strings into master

Problems found and obliterated:

  • drawColorString and drawColorStringBlended were the same. Now they correctly alias one another instead of being letter-to-letter copies. (And they were, I swear.)
  • drawColorString used LPEG and Font.size, which also used LPEG. This resulted in extreme double LPEGging of every word. See below.
  • drawColorString was word-to-word tstring.drawOnSurface except less powerful and with return value. So I expressed the former in terms of the latter. This also fixed aforementioned problem with using Font.size.
  • the same LPEG expressions were used in drawColorString, Font.size, and string.toTString. Now everything uses tstrings.
  • TStrings now cache results parsed from strings, so functions that accept fancy strings don't choke parsing them every time. Let me say, this helps. Results: tremendously improved performance on low-end machines.

Merge request reports

Loading