Hey!
So, I've worked on creating a little application with bitmap fonts. I can add color on top of the text without any issue.
However, I would like to know how I would go about being able to change the color for different parts of the text.
For example:
"Testing ^4this ^2thing", where ^4 would tell the application that the font after it should be red, and the ^2 being say yellow.
I thought about it and it feels like I would need to split the string up at those points and then create a new sprite for the following text. Does this sound like a good idea? Because I felt like this would be very bad if the original string was very large.
Any advice would be great.
Thanks
edit:
So I tried going about it in another way and I'm getting a strange behavior. I'm checking if the current letter is a '^' and if so, is the next letter a '1'.
If it is, set the color to blue. It does this but somehow the letter before '^' also gets the blue color, I'm at a loss here. Can't figure out why.
else if(Text[show] == '^')
{
if(Text[show+1] == '1')
{
sf::Color BlueColor(0,0,255);
FontSprite.setColor(BlueColor);
show = (show + 1);
}
}