Problem displaying text with the Text class

Hi,

I have a game set up extending BaseGame. I have attached a Text node to the rootNode (called scene in this case) which displays static text, and also have a node which is in the update loop which displays dynamic text.

The problem I have is that the text does not display, but is just black blocks. The size of the blocks seems to be representing the length of the text they should be displaying.


initGame() {
... other code....

        final Text timerLabel = new Text("timerLabel", "Time Elapsed:");
        timerLabel.setLocalTranslation(100, 120, 0);
        scene.attachChild(timerLabel);
....
}



That is the code of the static label. I assume once the problem is fixed for this then it should be fixed for the other.

Cheers,

Alex

Try to use the factory Method from the Text Class instead of the Constructor:

Text.createDefaultTextLabel("timerLabel", "Time Elapsed:");



This sets a default Texture- and Alphastate for your Text.

That works perfectly,



Thanks so much for your help!