Wednesday, June 28, 2017

java - Is there a way to capture back button twice in same activity libgdx game


Can anybody tell me if there is a possibility to capture back button twice in same activity in libgdx. What i want to achieve is that if the user press back button once the game pause. if in the pause screen user press back key again so the level exit. This happens well in "Video" that is the built in app in android OS. During video play a if user press back button it toast to press back again to exit.


so I want somthing like this.


if (Gdx.input.isKeyPressed(Keys.BACK)) {

code to call game pause state



if (Gdx.input.isKeyPressed(Keys.BACK)){ //// is this possible?

game.setScreen(new Menu(game))


}

} else {
code to call game resume state

}


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...