1
我試圖關閉後臺觸摸一個對話框,但它總是去在其他條件的背景圖像觸摸關閉對話框libgdx
stage.addListener(new InputListener(){
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
if(stage.hit(x,y,true).equals(bg)) {
System.out.println("in th if");
dialog.addAction(rotateTo(90, .30f, Interpolation.smooth2));
dialog.hide();
}
else {
System.out.println("int the else");
}
return true;
}
});
「stage」是什麼對象? – azizbekian
爲什麼不只是在背景上使用輸入監聽器? –
@azizbekian我可能誤解了你的問題先生,但它是這個https://github.com/libgdx/libgdx/wiki/Scene2d – Lynob