SFML community forums

General => Feature requests => Topic started by: Orezar on April 29, 2012, 04:26:06 pm

Title: sf::Text coloring chosen characters?
Post by: Orezar on April 29, 2012, 04:26:06 pm
Hello,

is it possible to implement a function that allows to give choosen Characters a special Color...

The problem is that it is to difficult if i work with hundred of sf::Text Objects...
This is the only solution that i can think of... So with my solution i must split the sf::Text Object
in many part sf::Text Objects...

Is there a way to make this easier?
If not, can you implement a function that allows this?

Because a picture says more than thousend words, thats what i want:
(http://s1.directupload.net/images/120429/temp/rxq27xg4.png) (http://s1.directupload.net/file/d/2875/rxq27xg4_png.htm)

I think a function like these:

setCharacterColor(fromCharacterPos, toCharacterPos, newColor)

would be perfect...

Lg
Title: Re: sf::Text coloring chosen characters?
Post by: Laurent on April 29, 2012, 04:35:55 pm
It seems like a very specific request, I can't find any use case where one would like to assign colors to specific characters in a text.

Could you tell me more about your use case?
Title: Re: sf::Text coloring chosen characters?
Post by: Orezar on April 29, 2012, 05:20:34 pm
I need it for a syntax highlighter and for a chat... :)

It is difficult and a little bit complicated using my solution for large Strings because of this
I ask here for this feature... don't hate me... :P
Title: Re: sf::Text coloring chosen characters?
Post by: Contadotempo on April 29, 2012, 07:13:13 pm
You could use something like this instead:
http://www.sfml-dev.org/wiki/en/sources/richtext

It's coded for SFML 1.6 but you could easily adapt it to SFML 2.0.
Title: Re: sf::Text coloring chosen characters?
Post by: Perde on April 29, 2012, 07:16:54 pm
Why don't you simply post your solution? You might even get a hint or two.