I just use jMonkeyPlataform xD. And I create a TestProject via new—>project
>TestProject. As you don't use jmp, you can download that somewhere....but I don't know where....
I just use jMonkeyPlataform xD. And I create a TestProject via new—>project
Honestly man, Ill never use the platform, it *s more shit up than it helps in anyway at all. All it does is crash constantly.
I run eclipse.
Since this problem is not solvable, I decide to fuckit an go with another solution.
@Addez: Did you get it? It looks you aren’t the only on having this issue, me too xD. The output says:
[java]
WARNNING: screen [optionsScreen] not found
[/java]
And the only thing I saw is a black screen
OK figured out
;D ;D. It didn’t work for us, because the “goToScreen()” method does go from a screen in a xml file to another screen in the SAME xml file, because the goToScreen() calls the “goToScreenInternal()” internally, then this method just work if the screens are in the same xml file.
EDIT: Also, and if you don’t wanna put all screens in a single xml file (like me :D, because keepping all screens in a single xml file is not a good practise) just recall the “nifty.fromXmlFile()” pointing to the other screen file ;). Good luck!
I have always had the screens in same file so I shouldn’t have a problem
BUT I disabled the logger thing so I get all warnings and I found this:
INFO: gotoScreen [end] aborted because still in gotoScreenInProgress phase
I dont see why it would do this. The menu isn’t diong anything atm i click it except highlighting the selected button.
Why would it abort, and can I override that?
We might have to know more about your code and setup. It seems like there are two transitions trying to happen at the same time.
What triggers the change to “end”? Is there a really long effect on the entry to the screen before “end”? I’m not a nifty expert, just making stabs in the dark based on my experiences.
@pspeed: Keeping the screen in separated xml files are the right thng to do right? But, the goToScreen() just work when the screen are in the same xml file, then there’s a way to create a xml file that includes all the other screens xml files on it so I can put it on nifty by “nifty.fromXmlFile(“Interface/screen/screens.xml”, “mygame.nifty.control.ScreensControl”);” ?
I don’t know. I have my files separated by app state mostly. So the only screen-screen transitions I make are within the same XML file.
hmm, ok. Also, nifty allow us to implement the “AbstractAppState” on our screen controller so we can access the app and stateManager ok?! But, so that takes effect we have to attach that to the AppState mannualy? Because the tutorial on wiki just says we can implement that, but it doesn’t say we have to attach it to the stateManager…then I do:
[java]
public class MyScreenController extends AbstractAppState implements ScreenController {
public void bind(…){}
public void onStartScreen(…){}
public void onEndScreen(…){}
}
[/java]
Then I do:
[java]
nifty.fromXmlFile(“myscreen”, “MyScreenController”);
MyScreenController control = nifty.getCurrentScreen().getScreenController();
stateManager.attach(control);
[/java]
Like this:
[java]
MyScreenController control = new MyScreenController();
stateManager.attach(control);
nifty.fromXmlFile(“myscreen”, control);
[/java]
…and make sure that the fully qualified class name is used in the XML since that’s how nifty matches them up to the screens.
Hey, finally I got to make my screens work keeping them in separated xml files…each xml file is a screen :D.
The wiki doesn’t teach how to do it, then for those guys who want to do that, here is it ;):
[java]
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, viewPort);
Nifty nifty = niftyDisplay.getNifty();
nifty.addXml(“Interface/Screens/OptionsScreen.xml”);
nifty.addXml(“Interface/Screens/StartScreen.xml”);
nifty.gotoScreen(“startScreen”);
StartScreenControl screenControl = (StartScreenControl) nifty.getScreen(“startScreen”).getScreenController();
OptionsScreenControl optionsControl = (OptionsScreenControl) nifty.getScreen(“optionsScreen”).getScreenController();
stateManager.attach(screenControl);
stateManager.attach(optionsControl);
guiViewPort.addProcessor(niftyDisplay);
[/java]
And my screen controller classes extends the AbstractAppState.
wtf, how great its that xD I didn’t even know that works ^^
Thanks, I added that tip to the Nifty Scenarios!
@zathras: What do u think about adding a tip for how to create custom styles too :D. I did myself styles. For example, insteand of calling the default nifty style:
[xml]
<useStyles filename=“nifty-default-styles.xml” />
[/xml]
We can call our custom style like this:
[xml]
<useStyles filename=“Interface/Styles/myCustomStyles.xml” />
[/xml]
Then inside the styles.xml file use ourself styles like this:
[xml]
<?xml version=“1.0” encoding=“UTF-8”?>
<nifty-styles>
<useStyles filename=“Interface/Styles/Font/myCustomFontStyle.xml” />
<useStyles filename=“Interface/Styles/Button/myCustomButtonStyle.xml” />
<useStyles filename=“Interface/Styles/Label/myCustomLabelStyle.xml” />
<!-- Here you’ll put your other custom styles -->
</nifty-styles>
[/xml]
I learned how to create styles by checking the nifty source code “nifty-style-black”.
Here’s what I did with myself styles :D:
THANKS ALOT glauco!
I redid it and put the screens in separate xml files and added them like you said and now it works!
I can finaly use goto screen!!
Thanks!!
Time for thumbsup rain again!
Cool, I added that tip, thanks glaucomardano!