I put the following Table button in my MenuScreen.java file to make a "start game" button:
// register the button "start game"
TextButton startGameButton = new TextButton( "Start game", getSkin() );
startGameButton.setTouchable(Touchable.enabled);
startGameButton.addListener( new InputListener() {
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
System.out.println("down");
Gdx.app.log( HowDrunkAreYou.LOG, "touch d" );
return true;
}
public void touchUp(
InputEvent event,
float x,
float y,
int pointer,
int button )
{
Gdx.app.log( HowDrunkAreYou.LOG, "touch d" );
super.touchUp( event, x, y, pointer, button );
game.getSoundManager().play( HowDrunkAreYouSound.CLICK );
//game.setScreen( new StartGameScreen( game ) );
}
} );
table.add( startGameButton ).size( 300, 60 ).uniform().spaceBottom( 10 );
For some reason the input handler never fires, java debugger never enters the method. What am I missing? I have tested it on desktop and android, same result.
Neither logcat or console gives me any information about what may be the error.
Thank you!