Nifty GUI cannot call SImpleApplication (9 posts)

  • Profile picture of elginlee elginlee said 3 months, 3 weeks ago:

    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

  • Profile picture of t0neg0d t0neg0d135p said 3 months, 3 weeks ago:

    I’m confused as to why you would need to start a new SimpleApplication? A little more info on this would be helpful!

  • Profile picture of cghislai cghislai10p said 3 months, 3 weeks ago:

    So your thread actually starts? I don’t see the call to start in your code.
    Also, don’t you need another container?

  • Profile picture of elginlee elginlee said 3 months, 3 weeks ago:

    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

  • Profile picture of elginlee elginlee said 3 months, 3 weeks ago:

    @cghislai

    What do you mean by another container?

  • Profile picture of cghislai cghislai10p said 3 months, 3 weeks ago:

    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.

  • Profile picture of elginlee elginlee said 3 months, 3 weeks ago:

    @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)

  • Profile picture of Tr3kk3r Tr3kk3r2p said 3 months, 3 weeks ago:

    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?

  • Profile picture of elginlee elginlee said 3 months, 3 weeks ago:

    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 :)