Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Glyph background colors  (Read 1473 times)

0 Members and 1 Guest are viewing this topic.

basmith

  • Newbie
  • *
  • Posts: 3
    • View Profile
Glyph background colors
« 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

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Glyph background colors
« Reply #1 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. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything