Java libgdx演员触摸处理
我目前在LibGdx上遇到了一些关于触摸处理的有趣问题。我的代码如下:-Java libgdx演员触摸处理,java,android,touch,libgdx,Java,Android,Touch,Libgdx,我目前在LibGdx上遇到了一些关于触摸处理的有趣问题。我的代码如下:- testCount=0; ThisButton.addListener(new InputListener() { public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { testCount++; gameLog("touchDown - testCount: " + testCount
testCount=0;
ThisButton.addListener(new InputListener() {
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
testCount++;
gameLog("touchDown - testCount: " + testCount);
return true;
}
public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
testCount++;
gameLog("touchUp - testCount: " + testCount);
}
})
理论上讲,testCount应该只返回2 1用于触地,1用于触碰演员时的触地。但是,我的LogCat输出在单次点击时返回多个调用
GreatGame: GameScreen: touchDown - testCount: 1
GreatGame: GameScreen: touchDown - testCount: 2
.
.
.
GreatGame: GameScreen: touchDown - testCount: 177
GreatGame: GameScreen: touchDown - testCount: 178
GreatGame: GameScreen: touchUp - testCount: 179
GreatGame: GameScreen: touchUp - testCount: 180
.
.
.
GreatGame: GameScreen: touchUp - testCount: 355
GreatGame: GameScreen: touchUp - testCount: 356
我不确定哪里出了错
非常感谢,非常感谢您的帮助
问候
Zi必须在其他设备上试用吗?谢谢,伙计,我已经在我的三星android和桌面上试用过了。在台式机和安卓手机上的结果相同。不知道哪里错了这确实不是我所期望的行为。也许可以尝试使用我刚刚测试过的ClickListener,代码可以完美地工作,使用Gdx.app.logTAG,着地-testCount:+testCount;当然,你的问题不是你的gameLog方法,而是你代码的其他部分,或者可能是你设备屏幕上的一个bug