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

libGDX: Why doesn't Gdx.input.isKeyJustPressed() work?

$
0
0

I’m trying to use the method Gdx.input.isKeyJustPressed() to check if the Android BACK button was just pressed. I don’t want to use the Gdx.input.isKeyPressed method to avoid multiple calls. Here is my code:

public void handleInput() {
    if(Gdx.input.isKeyJustPressed(Input.Keys.BACK)) {
         // show previous screen...
    }
}

public void update(float dt) {
    handleInput();
}

But unfortunately this doesn’t work. Any ideas?


Viewing all articles
Browse latest Browse all 434

Trending Articles