Hello,
So I’m trying to create an instance of a game class that extends from simpleApplication, which contains the game itself, from a method to be called by pressing a button in the GUI. The problem is the app gets frozen as soon a I click on it and doesn’t load the app. Any help would be appreciated
@NiftyEventSubscriber(id = "btnPlay")
public void onSwitchButtonPlay(final String id, final ButtonClickedEvent event) {
System.out.print("game");
Game app = new Game();
app.start(JmeContext.Type.Display);
}
@pspeed said:
But if this is a nifty button then isn't the application already running?
Well… technically yes, but then how should I start the game itself, I mean the GUI is there but I want the game to start after pressing the start button, how do you “eliminate” de GUI after starting it and then run the game itself?
@pspeed said:
Generally an application should only have one application in it.
What you describe is precisely what AppStates are for.
Isn’t there a way to do it without implementing app states, I’m literally in the deadline for my project D: I just don’t understand why does it crash when trying to run the game application after pressing the button
@DualHunter said:
Isn't there a way to do it without implementing app states, I'm literally in the deadline for my project D: I just don't understand why does it crash when trying to run the game application after pressing the button
“I don’t understand why my car crashes when I create a new car inside of my car.”
One application per application, please.
I don’t understand what the big deal. Making an app state is like a cut and paste job. You could have done it in less time than it took to think about and respond to the last post.