0
\$\begingroup\$

I have a weird issue that when I try to draw a Stage with only an Actor, a Label to be more precise, added to it and nothing seems to be getting drawn.

This is how my setup goes:

I have a Sprite (player) being drawn and in another class, which is the HUD, that I draw in a separate SpriteBatch, now in the same class I am trying to draw the Stage, I have ensured that the Stage is outside of the HUD's SpriteBatch.begin()/.end() calls and that the Stage is being drawn after, which should be "above" the HUD. I have also set the position, of the Actor, to be in the middle of the Stage

I just can't seem to get this to work.

This is my code for the Player class:

public void update(SpriteBatch spriteBatch, float delta){   
    // *** REMOVED FOR CLARITY ***
    spriteBatch.setProjectionMatrix(camera.combined);
    camera.update();
    hud.render(delta);
}

And this is my code for the HUD class

public void render(float delta){
    spriteBatch.begin();
    spriteBatch.draw(hudBackgroundTexture, position.x, position.y, size.x, size.y);
    // *** REMOVED FOR CLARITY ***
    spriteBatch.end();
    labelLives.setPosition(size.x/2, size.y/2);
    hudStage.act();
    hudStage.draw();
}

I'm not receiving any errors, and I know I have initialised my Stage and Label.

Thanks in advance =]]

\$\endgroup\$

closed as off-topic by Josh Mar 11 '14 at 22:49

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about debugging a problem in your project must present a concise selection of code and context so as to allow a reader to diagnose the issue without needing to read all of your code or to engage in extensive back-and-forth dialog. For more information, see this meta thread." – Josh
If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ Does your Stage draw any other actors that you add to it? If yes, then there might be a problem with the way you've initialized the Label or something. If not, then you're probably drawing something else on top of the stage. \$\endgroup\$ – VictorB Mar 11 '14 at 21:38
  • \$\begingroup\$ I figured out what the problem was, something very stupid xD \$\endgroup\$ – user959631 Mar 11 '14 at 22:44
0
\$\begingroup\$

Haha, well, I found out what was up, it was my font file, you see when I was editing it, I used the text READY, so when I saved it, I didn't know that the text written is what is saved, so when I looked at the font.png file, I found that it only contained the letters ADERY.

Thanks for the help anyway =]

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.