Reputation: 1065
My shapes drawn by shape renderer does not show when I use skins. The shape is drawn inside the actor using an instance of ShapeRenderer. I think this is caused by the skin because I tried adding an empty table and the shapes show, but if I add an instance of a skin the shapes does not show.
This code is from the libgdx tests in github:
Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));
Label nameLabel = new Label("Name:", skin);
Table t1 = new Table();
t1.setFillParent(true);
t1.add(nameLabel);
stage.addActor(t1);
Upvotes: 1
Views: 242
Reputation: 6221
you need to .end()
the SpriteBatch
befor using the ShapeRender.begin()
after the ShapeRender.end()
you need to call SpriteBatch.begin()
in your actor. Else you do have 2 concurenting batches.
actor.draw(SpriteBatch batch, float delta){
batch.end();
ShapeRender.begin(Some Typee);//start it with your shapetype
//drawing stuff with the shaperender
ShapeRender.end();//dont forget to end it
batch.begin(); //need to be started again for the next actors to be dawn
}
An empty table shouldnt be a problem.
Upvotes: 2