[Solved] Saving General Settings With Settings Override

In a game I’m making, I used the [java]settings.setFrameRate(60)[/java] to limit my frame rate to 60fps, however upon starting the game, all other settings are always set to default, rather than what they were last set to… I’ve tried saving and loading my settings, but that doesn’t change anything… (my guess is that it saves the setFrameRate(60) but not the other things the user set…)



Eg: Upon starting my game, it asks me for screen resolution, etc. I set them to the values I want. When I start the game again, all of the settings are default, rather than what I set them to…



How can I change this

http://hub.jmonkeyengine.org/javadoc/com/jme3/system/AppSettings.html#AppSettings(boolean)



Notice the parameter on the constructor.

-.- I looked there, and scrolled right over it…

I just tried that, but it simply crashed.



My Code:

[java]

AppSettings settings = new AppSettings(false);

settings.setFrameRate(60);

Start app = new Start();

app.setSettings(settings);

app.start();

[/java]



The Error:

Exception in thread “main” java.lang.NullPointerException

at com.jme3.system.JmeDesktopSystem.showSettingsDialog(JmeDesktopSystem.java:73)

at com.jme3.system.JmeSystem.showSettingsDialog(JmeSystem.java:108)

at com.jme3.app.SimpleApplication.start(SimpleApplication.java:127)

at freefall.Start.main(Start.java:20)

Java Result: 1

What version of JME are you running? Plain beta or latest table update?

I think there is a bug in JmeDesktopSystem that causes an NPE if you haven’t set a settings dialog image.



If getSettingsDialogImage() returns null then JmeDesktopSystem crashes with an NPE. It’s a bug… you could file a bug report if you want.



edit: and as a work around, you could set the image. Set it to “/com/jme3/app/Monkey.png” if you want the normal monkey logo.

Thanks for the advice on the dialog image, I’ve never heard of it before, but it did certainly fix the problem. As far as the bug report goes, you’re a developer and if you already know about the bug, then I see no reason to make a report. Again, thanks for helping.

1 Like
@chessmaster942 said:
Thanks for the advice on the dialog image, I've never heard of it before, but it did certainly fix the problem. As far as the bug report goes, you're a developer and if you already know about the bug, then I see no reason to make a report. Again, thanks for helping.


Ok... except it will probably be a month until I can look at it myself. Hopefully I remember or someone else was watching because I also don't have time to file a bug report.

If you want me to, I can. The reason why I didn’t is because I thought it’d be more work for you. :slight_smile:

@chessmaster942 said:
If you want me to, I can. The reason why I didn't is because I thought it'd be more work for you. :)


Heheh... nah, just the opposite. If you do it then I don't have to file it and I can safely forget about it. Someone else might do it or I will see the bug later.

Ok, I’ll get on it when I get home in about 1-1/2 hours.

Just finished bug report. Issue 529.