SFML community forums

Help => Graphics => Topic started by: escher on April 20, 2012, 04:13:32 am

Title: sf::Text Background Color
Post by: escher on April 20, 2012, 04:13:32 am
Is there any way to set a background color for an sf::Text object? I can't seem to find one in the documentation, but I may just be blind. If there's not, any recommendations on how to best fake it out? I'm tinkering with a pretty-console roguelike (see Brogue (https://sites.google.com/site/broguegame/) for an example), and being able to set background colors on a string/character basis is sort of important.

I recognize that I could use a sprite sheet with the characters, but that just feels kludgey, especially when scaling comes in to play. I trust the font system to handle resizing much better than naive resizing of a sprite.
Title: Re: sf::Text Background Color
Post by: Groogy on April 20, 2012, 07:47:16 am
sf::Text don't have a background color. At all. It only renders the characters. What you can do is put a rectangular shape under the text.
Title: Re: sf::Text Background Color
Post by: escher on April 20, 2012, 12:21:04 pm
sf::Text don't have a background color. At all. It only renders the characters. What you can do is put a rectangular shape under the text.

That's rather unfortunate. I can think of a lot of scenarios where a background color would be desirable, and it seems like a pretty common option in many other libraries.
Title: Re: sf::Text Background Color
Post by: Laurent on April 20, 2012, 12:58:32 pm
Since you made a feature request, I have to lock this topic so that the discussion is not duplicated.

http://en.sfml-dev.org/forums/index.php?topic=7653.0