for (int i = 0; i < 20; i++) {
    if (Gdx.input.isTouched(i)) {
        player1.touchPosition = new Vector3(Gdx.input.getX(i), Gdx.input.getY(i), 0);
        camera.unproject(player1.touchPosition);
    }
}


它正在工作,但我想将InputProcessor与touchDragged事件一起使用。

如何将此代码转换为InputProcessor?

最佳答案

   public boolean touchDragged(int screenX, int screenY, int pointer) {
    if (pointer < 20) {
                player1.setTouchPosition(new Vector3(Gdx.input.getX(pointer), Gdx.input.getY(pointer), 0));
                camera.unproject(player1.getTouchPosition());        }
    return true;
}

关于java - Java LibGDX InputProcessor多点触控,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39127473/

10-10 10:04