Hi guys, I have used Nifty GUI as the main menu and then from the main menu i need to start another SimpleApplication.
Does anyone know how to call it properly?
I invoked the Simple Application using this code but it stops at “INFO: Selected display mode: 1362 x 768 x 0 @0Hz” :
@NiftyEventSubscriber(id=“NagivateToPage3”)
public void onButtonClick(final String id, final ButtonClickedEvent event) {
navigateButton.disable();
System.out.println(“Slider”);
Thread t = new Thread(new Runnable() {
public void run() {
TestWalkingChar twc = new TestWalkingChar();
twc.setShowSettings(false);
twc.start();
}
});
navigateButton.disable();
}
The TestWalkingChar class is to big to be posted and it is here http://dl.dropbox.com/u/32670759/TestWalkingChar.java
Could someone please help me? I have been trying to fix this for the longest time
I’m confused as to why you would need to start a new SimpleApplication? A little more info on this would be helpful!
So your thread actually starts? I don’t see the call to start in your code.
Also, don’t you need another container?
Hi, basically. There is a button on the main menu that says “Run game” then it would load the screen and the game would play
I mean, new AppContainer(new TestWalkingChar);
But that will launch you a new window as a separate app.
If you plan is to have a mainmenu, and start the game when you click on that button, i would suggest you to read the documentation where game states should be explained in details.
@cghislai
After reading all the documentaton on gamestates … I realised i am extending SimpleApplication already and i cannot change it as i need to use the statemanager and other stuff. So how to is it possible to create a new gamestate then run the SimpleApplication within the gamestate (rather than extending AbstractGame)
Why would you like to have a new SimpleApplication?
If you want a main menu, make your main menu a gamestate. Then, make your game a gamestate. When someone cklicks “Start Game”, you deactivate the main menu gamestate and activate the “ingame” gamestate. There is no need to create a whole new Application.
I don’t really understand your problem? Why can’t you use the statemanager of your already existing application?
Ok i got it working already! The solution is as stated by Tr3kk3r, Thanks so much!
The code is too long to post. If you need it, drop me a mail. Thank again guys