0
我是Libgdx的新手,我正在开发一个菜单屏幕有声音按钮的游戏。这是默认情况下打开,我想更改为其他声音关闭PNG时触摸意味着我想改变纹理的精灵,但下面的代码似乎并没有工作。如何更改屏幕上的雪碧
@Override
public void show(){
s = new Sprite(new Texture(Gdx.files.internal("soundon.png")));
}
@Override
public void render(float delta) {
camera.update();
Gdx.gl.glClearColor(1, 1, 1, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.setProjectionMatrix(camera.combined);
batch.begin();
s.draw(batch);
s.setBounds(w-w/7,h*asp-w/7, w/10,w/10);
batch.end();
}
public boolean touchUp (int x, int y, int pointer, int button) {
if(s.getBoundingRectangle().contains(x,y)){
s.setTexture(new Texture(Gdx.files.internal("soundoff.png"));
}
return true;
}
:)它像魅力一样。感谢兄弟。 –