At the moment my code looks like this:
tPrint("Hello "); tSetColor("yellow"); tPrint("world"); tSetColor("white"); tPrint(". ");
tDrawImage("images/morale.png"); tPrint("Morale "); tSetColor(255,100,80); tPrint("150"); tSetColor("white");
I wish it looked something like this:
tPrintRich("Hello [color=yellow]world[color=white]. [img=images/morale.png]Morale [color=255,100,80]150[color=white].");
So, I need some sort of a very simple parser, just 2 tags/codes [color=XXX] and [_img=XXX]. It's run in realtime each frame, so, while overall such things do not consume a lot of CPU since it's text display, it should be reasonably fast.
In addition I need strlen function:
int width=tStrlenRich("a[color=yellow]b[color=white]c");
where returned width is 3 (so with all codes skipped).
How do I approach this? Probably it does not make sense to get an existing parsing library, it would be an overkill for this...