I found out that in LibGDX there is a new component in nightly builds - TextArea , which is part of the scene2d.ui package. It's nice to have such a component that is very easy to use, but what I am missing is support for multicolor text.
I want to highlight some keywords in the text with a different color, but I do not know how to do this with the current api. There is one method in the BitmapFontCache class:
public void setColors (Color tint, int start, int end)
The javadoc for this method says the following:
Sets the color of the specified characters. This can only be called after setText (CharSequence, float, float) and reset with every call to setText.
But I do not know how to use it through the TextArea object, or if it is possible to do so. Someone who was trying to figure this out? Every hint will be appreciated.
java libgdx
Jan Tobola
source share