简体   繁体   中英

Java LibGDX InputProcessor Multi Touch

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);
    }
}

It's working but I want to use InputProcessor with touchDragged event.

How can I convert this code to 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;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM