Bitmap Text Hidden With Element

Hi there,

I’m making a game for the jme blendswap arcade contest, and I’m having an issue :stuck_out_tongue:

I’ve been having an issue with BitmapTexts being removed with elements being hidden with an element.

For some reason when I call the method thisElement.hide();

It also hides my Bitmap Score display in the corner.

Go ahead and take a look at the culprit class

The whole project is also available for viewing or compiling there, to see the issue.

When pressing the start game button, it removes the score display.

When the showStartButton method is called, the display shows back up!

So the display only displays when the startMenu is displayed D:

What could be causing this!

Thanks for reading!

Try out the TextElement class in place of BitmapText and see if you still have the issue. Here is an example of using it:

[java]
// dimensions for text is a rectangle bounds that is used for alignment positioning
// font is the actual BitmapFont to use
TextElement el = new TextElement(screen, UID, Vector2f.ZERO, new Vector2f(300,50), font) {
@Override
public void onUpdate(float tpf) { }
@Override
public void onEffectStart() { }
@Override
public void onEffectStop() { }
};
el.setIsResizable(false);
el.setIsMovable(false);
el.setTextWrap(LineWrapMode.NoWrap);
el.setTextVAlign(VAlign.Center);
el.setTextAlign(Align.Center);
el.setFontSize(18);
el.setText(“This is a sample TextElement”);

screen.addElement(el);
[/java]

This uses BitmapFont, but is a complete rewrite of BitmapText that solves quite a few issues.

Out of curiosity, I see the text is added as part of an appstate. Is the appstate being removed?

EDIT: Scratch this… I just looked through the rest of the class (to check for a cleanup method). It wouldn’t make a difference as the text is never removed…