SFML community forums

Help => Graphics => Topic started by: acrazyplayer on August 13, 2012, 12:55:29 am

Title: Text scrolling help
Post by: acrazyplayer on August 13, 2012, 12:55:29 am
Hello all, I am having some difficulty figuring out how to make text scroll or pop up slowly.

An example video is at the bottom of this post.

I don't need all the code handed to me. I just need the bare minimum to go about making it happen. Any help would be greatly appreciated. Thanks in advance!

Here is a video showing exactly what I want to happen with the text...     http://youtu.be/CBL9AenRLeA?t=44s
Title: Re: Text scrolling help
Post by: eXpl0it3r on August 13, 2012, 01:14:46 am
You'll have to use a sf::Clock and create a delay before adding the next character to the sf::Text to get a scrolling effect.

For a fading effect one of the easiest solutions is, to use a sf::RectangleShape and set it's alpha channel first to fully filled and then slowly changing it until you get to fully transparency.
Title: Re: Text scrolling help
Post by: 7krs on August 19, 2012, 01:49:04 pm
You'll have to use a sf::Clock and create a delay before adding the next character to the sf::Text to get a scrolling effect.

Yea but there is no sf::Text::push_back, so I suggest he needs to create an std::string (yes, it's "an" before an abbrevation due to the pronunciation of "es", the first letter in std) where you push back each character.
After that, you use sf::Text::setString(std::string) and redraw the text.
Of course you use a delay like exploit3r said, or you could make it dependent on screen refresh rate. sf::RenderWindow::setFramerateLimit(unsigned in);