Quantcast
Channel: Question and Answer » libgdx
Viewing all articles
Browse latest Browse all 434

How to set cursor position to middle of screen while still being able to change the Delta-X

$
0
0

I have this code:

@Override
public boolean mouseMoved(int screenX, int screenY) {
    float deltaX = Gdx.input.getDeltaX();
    camera.rotate(Vector3.Y, deltaX * -0.3f);
    Gdx.input.setCursorPosition(Gdx.graphics.getWidth() / 2, -Gdx.graphics.getHeight() / 2);
    return true;
}

I need to be able to set the cursor position to the centre of the screen while still being able to move the mouse a little bit and get the delta-x. This is so the mouse doesn’t get stuck at the edge of the screen so, if there’s any other way to do this, that’s useful too!


Viewing all articles
Browse latest Browse all 434

Trending Articles