1

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);
4

1 回答 1

2

你需要在你需要调用你.end()的演员之后SpriteBatch使用之前。否则,您确实有 2 个并发批次。ShapeRender.begin()ShapeRender.end()SpriteBatch.begin()

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
}

一张空桌子不应该是一个问题。

于 2013-05-28T07:04:13.313 回答