如何在libgdx中点击一次按钮



按钮会倒计时多次单击,但我只需要单击一次。我怎么能只点击一次。我尝试了InputListener、EventListener、ChangeListener和ClickListener。或者这不是问题所在?请帮帮我。

Look.addCaptureListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
touched=true;
}
});
if(!Gdx.input.isTouched()) {
OpenActions.addListener(new InputListener() {
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
System.out.println("X:" + x + " Y:" + y);
return true;
}
public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
System.out.println("touchup");
}
});
}

正如你所看到的,我试图只点击一次,而不可能再点击一次。但我失败了。

我被添加了一个监听器到render(((循环方法(。。。这是一个错误。我移动了一个监听器来创建((,然后我的问题就解决了。

最新更新