Unexpected actions from AppSettings

Today, I was building a tech demo and I used:

AppSettings settings = new AppSettings(true);
settings.setFullscreen(true);

TestMonkeyTaskBinder app = new TestMonkeyTaskBinder();
app.setSettings(settings);
app.start();

Then, the monitor resizes unexpectedly without showing up the application game and it keeps freezing in this state (even after shutting down the application process):

I know that there were new updates of separating the dialog API from the core APIs, but I didn’t expect this to happen, any clue?

I actually haven’t looked into the actual AppSettings logs, it was annoying to see it when doing something important and cannot recover.

1 Like

Fullscreen mode can behave oddly if the width and height in the AppSettings don’t correspond to the resolution of the current screen.

When starting an app in fullscreen mode, the safest thing is to use the current screen resolution. Note that the default width in AppSettings is 640.

If I were debugging your issue, the first thing I’d do is look at the values in AppSettings just before app.start().

1 Like

Note from memory: if you don’t give your app settings an app title then it will just load whatever settings you last used from your previous app settings without an app title. This can leave some weird stuff hanging around if you did one run where you set strange things from the settings dialog.

This is my typical pattern to make everything happy:

        Main main = new Main();
        AppSettings settings = new AppSettings(true);

        // Set some defaults that will get overwritten if
        // there were previously saved settings from the last time the user
        // ran.
        settings.setWidth(1280);
        settings.setHeight(720);
        settings.setVSync(true);
        
        // Note: JME uses the title to save so these two must match.
        settings.load("MyApp");
        settings.setTitle("MyApp");
        
        main.setSettings(settings);
        main.start();

…and that’s with letting JME still popup the settings dialog but it will be preset with whatever was saved before.

1 Like

I tried this:

  AppSettings settings = new AppSettings(true);
  settings.setTitle(TestMonkeyTaskBinder.class.getName());
  settings.load(TestMonkeyTaskBinder.class.getName());
  settings.setFullscreen(true);

  TestMonkeyTaskBinder app = new TestMonkeyTaskBinder();
  app.setSettings(settings);
  app.start();

And, I am still getting the same issue.

Debugging shows the resolution for “full screen” defaults to Height x Width = 480 x 640.

The documentation says passing “true” to the AppSettings constructor will load the default settings (that should overwrite any previous cache values), so I shouldn’t be in need of manually defining which preferences to load.

Btw, another unexpected issue happens when passing “false” to the AppSettings(boolean) constructor, the “jME3 Main” thread defaults to “jME3 Headless Main” and JME runs in headless mode.

I suggest logging the AppSettings actions for debugging purposes (maybe in the next JME release) to be able to test issues easily, for example: {Which preferences have been loaded?}

EDIT:

This value is the same as the one with “fullscreen = false” (Window mode), if anyone could try to reproduce this issue, please let me know, and I will try to reproduce this issue when using the JME dialog.

Try with a different resolution and see if it makes any difference. For example with standard HD resolution: settings.setResolution(1280, 720);

By the way, is there any error log in the console?

1 Like

I tried, but no full screen at this particular resolution, I will try with the JME dialog.

Not relevant to resolution and AppSettings, which is why I suggested logging the AppSettings values.

1 Like