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