how to get a list of values for settings. like the screen resolution values list in the startup of the Jme game?
and the list of values for the color Depth and anti-aliasing?
Simply monkey out the jME dialog?
I mean, I guess you have disabled that and want to build your own? If I misunderstood, just enable the default one and those things get prompted when your app is started.
no, I want to show it in the internal window and change settings in-game not in the start-up of the game.
Open JME code.
See how that code does it.
I think you cannot do that , you need to exit the game , change them & re-enter it because these settings control the rendering ,but there are chances to get & set them easily when you out of the game
EDIT : you can attach those sets in a separate gui class
No, this is wrong. You can change these settings while playing the game just like in any other “standard” game.
As pspeed said… look at the code how jme does it
JME doesn’t have an example of restarting with new settings I think (maybe it does).
It’s straight forward, though. Set new app settings and then restart the context.
I guess @jayfella had a utility library for easing in-game modification but seems GitHub page is not available?
Looks like Bintray link is still working though.
In a LegacyApplication
, all these settings are stored in a com.jme3.system.AppSettings
instance that’s accessible via the application’s (protected) settings
field.
The values for color depth can be obtained (for full-screen modes) from AWT. Here’s how I build the color depth menu for Maud:
if (displaySettings.isFullscreen()) {
int height = displaySettings.height();
int width = displaySettings.width();
GraphicsEnvironment environment
= GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice device = environment.getDefaultScreenDevice();
DisplayMode[] modes = device.getDisplayModes();
for (DisplayMode mode : modes) {
int modeDepth = mode.getBitDepth();
int modeHeight = mode.getHeight();
int modeWidth = mode.getWidth();
if (modeDepth >= 16 && modeDepth != depth
&& modeHeight == height && modeWidth == width) {
String modeItem = Integer.toString(modeDepth);
if (!builder.hasItem(modeItem)) {
builder.add(modeItem);
}
}
}
And here’s how I build the anti-aliasing menu:
for (int factor : new int[]{1, 2, 4, 6, 8, 16}) {
if (factor != selectedFactor) {
String description = describeMsaaFactor(factor);
builder.add(description);
}
}