更新时间:2023-01-25 14:39:15
我使用了这个链接中的例子.https:///github.com/libgdx/libgdx/blob/master/tests/gdx-tests/src/com/badlogic/gdx/tests/GestureDetectorTest.java.
I used the example in this link. https://github.com/libgdx/libgdx/blob/master/tests/gdx-tests/src/com/badlogic/gdx/tests/GestureDetectorTest.java.
@Override
public boolean fling(float velocityX, float velocityY, int button) {
if(Math.abs(velocityX)>Math.abs(velocityY)){
if(velocityX>0){
iX+=20;//x cordinate
}else if (velocityX<0){
iX-=20;
} else {
// Do nothing.
}
}else{
// Ignore the input, because we don't care about up/down swipes.
}
return true;
}