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

Author Topic: Text scrolling help  (Read 1938 times)

0 Members and 1 Guest are viewing this topic.

acrazyplayer

  • Newbie
  • *
  • Posts: 6
    • View Profile
Text scrolling help
« 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
the future has passed

eXpl0it3r

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

7krs

  • Newbie
  • *
  • Posts: 39
    • View Profile
    • Email
Re: Text scrolling help
« Reply #2 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);

 

anything