How can I implement a right-to-left scrolling text ticker in libGDX (like stock tickers)?

  • \$\begingroup\$ "Ticker"? Perhaps add a gif showing the effect you're looking for (use the image symbol while editing to add an image). You should also edit in what you have tried and why that did not work. \$\endgroup\$
    – Charanor
    Commented Sep 9, 2018 at 17:07
  • 1
    \$\begingroup\$ @Charanor "ticker" is a common term for a one-line text display that automatically slides the text horizontally over time to display a string of text longer than the width of the display, similar to the deprecated <marquee> HTML element. \$\endgroup\$
    – DMGregory
    Commented Sep 11, 2018 at 1:45

1 Answer 1


Assuming that you can draw a string on the screen, to implement a ticker, you can simply draw only part of the string. For example:

string myString = "My large text to display";

When you are drawing it, simply draw part of it depending on a value you update every frame:

int strPointer = 0;
string myTickerString = "";

void update() {
    myTickerString = myString.Substring(strPointer, MAX_STRING_SIZE);

Now myTickerString will contain part of your original string, that every frame loses one letter and displays the rest of the string with a maximum size of MAX_STRING_SIZE (The size you choose).

Please note I'm not very familiar with libgdx, but this method should work with any library. For this reason the code is C#/Pseudocode. Also note you can add some delay to how quickly the text scrolls, by tweaking how often strPointer increments itself.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .