SFML community forums

Help => Graphics => Topic started by: basmith on September 16, 2013, 10:18:28 pm

Title: Glyph background colors
Post by: basmith on September 16, 2013, 10:18:28 pm
Hi,

I'm writing a roguelike with a pseudo-terminal appearance (in SFML.net).  I'm drawing Glyphs in a grid layout, but the only obvious way I noticed to apply a per-Glyph background color was to draw a RectangleShape behind it.

Is this sub-optimal and if so, is there a better way?

Cheers
Title: Re: Glyph background colors
Post by: eXpl0it3r on September 16, 2013, 10:28:32 pm
sf::Text is a relative basic class, thus it doesn't have such a feature. You now could either implement your own text class or keep going with the rectangle shape approach. In programming there are always many ways to achieve something and mostly there's no "perfect" way. As long as you don't run into performance issues, drawing rectangle shapes should be fine, you could however also use a vertex array and reduce the draw calls dramatically. ;)