触摸板不可见,没有错误。他在“//创建触摸板皮肤”之间启动。我尝试了很多方法,但都错了。那里有什么问题?
public WorldRenderer(World world) {
spriteBatch=new SpriteBatch();
this.world = world;
this.cam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
SetCamera(CAMERA_WIDTH / 2f, CAMERA_HEIGHT / 2f);
loadTextures();
//Create a touchpad skin
Texture touchpadTexture = new Texture(Gdx.files.internal("data/touchpad.png"));
touchpadTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
TextureRegion background = new TextureRegion(touchpadTexture, 0, 0, 75, 75);
TextureRegion knob = new TextureRegion(touchpadTexture, 80, 0, 120, 120);
TextureRegionDrawable backgroundDrawable = new TextureRegionDrawable(background);
TextureRegionDrawable knobDrawable = new TextureRegionDrawable(knob);
Touchpad touchpad = new Touchpad(10, new Touchpad.TouchpadStyle(backgroundDrawable, knobDrawable));
touchpad.setBounds(15, 15, 200, 200);
world.addActor(touchpad);
//Create a touchpad skin
}