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

Author Topic: SFML Text vertices  (Read 1162 times)

0 Members and 1 Guest are viewing this topic.

Doodlemeat

  • Guest
SFML Text vertices
« on: September 20, 2014, 08:14:36 pm »
Why won't SFML let me access the vertices of sf::Text? I want to use them for outline and for creating a shadow. Is there any way I can access them?

Hapax

  • Hero Member
  • *****
  • Posts: 3367
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: SFML Text vertices
« Reply #1 on: September 20, 2014, 08:36:40 pm »
The vertices are private.

You could move them to public or create a public function to access them and then rebuild your custom SFML.

Although, for flexibility, I'd like SFML to provide this access, I doubt that it'll add this functionality as it's not a particularly common thing to need.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: SFML Text vertices
« Reply #2 on: September 20, 2014, 09:34:42 pm »
Why won't SFML let me access the vertices of sf::Text?
Encapsulation, or what did you think? :)

But the vertices don't refer to border points of each letter, they're rather the vertices in the (rectangular) texture containing the rendered glyphs. So I'm not sure how this helps for outlines and shadows.

To achieve those effects, you could either use a shader, or render modified versions of the text in advance. For example, a shadow can be achieved by a black half-transparent text, and an outline by 4 texts, each of which is shifted by 1 pixel in another direction.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: