0
\$\begingroup\$

Ok so i have 3 sprite textures and while i have a stage being drawn with Stage.draw(); only the first two will draw. but if i add a 4th then 3 will draw. However if i remove Stage.draw then everything works as normal (except my labels)

public void render(float delta) {
    Gdx.gl.glClearColor(.3f, .3f, .35f, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    game.batch.begin();

    game.batch.draw(headbox, HEADBOX_X, HEADBOX_Y, HEADBOX_W,HEADBOX_H);

    game.batch.draw(textbox, TEXTBOX_X, TEXTBOX_Y, TEXTBOX_W,TEXTBOX_H);




    if(Gdx.input.isKeyPressed(Input.Keys.ESCAPE)){
        //TODO: Pause menu
    }

    if(Gdx.input.isKeyJustPressed(Input.Keys.ENTER) && labelCount < Labels.size() - 1){
        Labels.get(labelCount).remove();
        labelCount++;
        stage.addActor(Labels.get(labelCount));
    }
    if(labelCount == 5){
        game.batch.draw(jame, HEADA_X, HEADA_Y, HEADA_W, HEADA_H);
        System.out.println("drawing");


    }

    stage.draw();
    stage.act();


    game.batch.end();
}

In ther code here only the headbox texture will draw until Label count gets to 5 then textbox will draw

\$\endgroup\$
-1
\$\begingroup\$

I had to put stage.act before batch.begin and stage.draw after batch.end

|improve this answer|||||
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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