我尝试在Actor上使用InputListener
,但似乎没有调用touchUp。其他每种方法都适用于我。
stage = new Stage(new ScreenViewport());
Widget actor = new Widget();
actor.setFillParent(true);
actor.addListener(new InputListener() {
public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
Gdx.app.log("", "");
}
});
stage.addActor(actor);
Gdx.input.setInputProcessor(stage);
答案 0 :(得分:2)
stage = new Stage(new ScreenViewport());
Widget actor = new Widget();
actor.setFillParent(true);
actor.addListener(new InputListener() {
@Override
public void touchDown(InputEvent event, float x, float y, int pointer, int button) {
return true;
}
@Override
public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
Gdx.app.log("", "");
}
});
stage.addActor(actor);
Gdx.input.setInputProcessor(stage);