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

Author Topic: Text Wrapping after length  (Read 5176 times)

0 Members and 1 Guest are viewing this topic.

Kavex

  • Newbie
  • *
  • Posts: 2
    • View Profile
Text Wrapping after length
« on: November 26, 2014, 07:33:04 pm »
I'm trying to display text on the screen which is being pulled from a string. Of course the string is long and I'm looking to wrap it after a length or word count.

Any ideas?

sf::Text text;
text.setFont(font);
text.setCharacterSize(12);
text.setColor(sf::Color::White);
text.setPosition(20, 20);
text.setString(string);

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Text Wrapping after length
« Reply #1 on: November 26, 2014, 07:41:09 pm »
Count characters (or width of substring), insert newlines as appropriate.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Text Wrapping after length
« Reply #2 on: November 26, 2014, 08:05:52 pm »
Search in the forum, there have been quite a few threads about this.

And please post in the correct subforum, this has nothing to do with the C binding ;)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: