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;
}
:)它像魅力一樣。感謝兄弟。 –