I've got a main class containing
registerscreen = new registerScreen(this);
emailRegisterscreen = new emailRegisterScreen(this);
The registerScreen
contains a emailButton, with a listener, made in the constructor:
emailButton.addListener(new ClickListener() {
@Override
public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
super.touchUp(event, x, y, pointer, button);
Gdx.app.log("registerscreen", "email clicked");
gameHolder.setScreen(gameHolder.emailRegisterscreen);
}
});
gameHolder
is the main class.
Now, this above example only works if I initialize emailRegisterscreen
before emailScreen
(the snippet above does not work). I was wondering if it's possible to get it working and still defining the registerscreen first?
I'm guessing Java uses the current value of gameHolder.emailRegisterscreen
instead of a reference to it or something.