Answers for "libgdx move camera with touch"

1

libgdx move camera with touch

@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
    //difference between the current pointer location and the last pointer location on X axis
    float x = Gdx.input.getDeltaX();
    //difference between the current pointer location and the last pointer location on Y axis
    float y = Gdx.input.getDeltaY();

    camera.translate(-x,y);
    return true;
}
Posted by: Guest on April-12-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language