Creating a new AppSetting

HI guys,
As usual I got fed up of the display settings showing up againa and again and decided to create my own GUI settings like this:
[java] AppSettings settings = new AppSettings(true);
settings.setResolution(1024,768);
app.setSettings(settings);
app.setShowSettings(false);[/java]

The display settings dont show up anymore but the problem is
1)The window is centered somewhere to the bottom right instead of the center which never used to happen before
2)The text and images inside the window lokk distorted -They are not clear as they used to be?
What am I missing here?

Maybe you should provide the code relevant to your question ?
You speak about GUI, window, text and images, but there is none of that in the shown extract.

The code I am using is the same exact unmodfied code from https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:nifty_gui called NiftyGuiDemo.zip

Hi guys,
This seems to be very strange but I observe that whenever I try to override the default app setting dialog by app.setShowSettings(false) the gui is completely distorted and not even centered on my screen correctly. I would like to know if anyone has expirienced a similar problem when trying to not get the display setting to be shown? Could someone please try it out and tell me if it is a bug or not? I have tried it with the monkeyzone project as well as the nifty gui samples.

I don’t display the settings dialog and there is no problem for me.

How do you prevent it from showing up? I used the following code:

[java]AppSettings settings = new AppSettings(true);
settings.setResolution(1024, 768);

app.setSettings(settings);
app.setShowSettings(false);
app.start()[/java]

And I have observed it with both the monkeyzone project as well as the nifty gui samples? Is there something else I need to add?

I set more parameters but that’s basically what I do and it works fine for me. Maybe post a simple test case to see if others have the issue. It may be specific to your system.

[java]package mygame;

import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.system.AppSettings;

/**

  • test

  • @author normenhansen
    */
    public class Main extends SimpleApplication {

    public static void main(String[] args)
    {
    AppSettings settings = new AppSettings(true);
    settings.setResolution(1024, 768);
    Main app = new Main();
    app.setSettings(settings);
    app.setShowSettings(false);
    app.start();
    }

    @Override
    public void simpleInitApp() {
    Box b = new Box(Vector3f.ZERO, 1, 1, 1);
    Geometry geom = new Geometry(“Box”, b);

     Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
     mat.setColor("Color", ColorRGBA.Blue);
     geom.setMaterial(mat);
    
     rootNode.attachChild(geom);
    

    }

    @Override
    public void simpleUpdate(float tpf) {
    //TODO: add update code
    }

    @Override
    public void simpleRender(RenderManager rm) {
    //TODO: add render code
    }
    }[/java]

The above code doesn’t center the window. Could you check it on your machine?

I won’t have time for a while but now that you’ve posted it then hopefully others can try it, too.

I’ve tried your test case. I actually don’t know what exactly you mean by ‘doesnt center the window’.
On my laptop the application window is not really, but almost centered.

In the end there is no difference whether running your test case or running the application with the settings dialog like this
[java]public static void main(String[] args)
{
Main app = new Main();
app.start();
}[/java]

and selecting the analogue resolution.

I guess this doesn’t help :frowning:

Do you mean to say that the app setting dialog does not show and the Window does not have to be dragged to see the full view? Beacuse for me
these 2 lines make a hell of a difference
[java]app.setSettings(settings);
app.setShowSettings(false)[/java]

@Saba said: Do you mean to say that the app setting dialog does not show and the Window does not have to be dragged to see the full view? Beacuse for me these 2 lines make a hell of a difference [java]app.setSettings(settings); app.setShowSettings(false)[/java]

He means that, like the rest of us, this is no problem for him. We can start apps with no settings dialog and the app window appears in the normal place as if we’d had a settings dialog.

Something must be odd about your system or something.

Could you make any guesses regarding what this issue could be? I have a 1920x1080 monitor resolution. Also in the logs when I dont use the dialog I observe this line is missing (it may well be initializing of the dialog itself but I thought I should mention it anyway)

[java]Mar 1, 2013 7:57:02 AM com.jme3.system.JmeDesktopSystem initialize\par
[/java]

Maybe you have some bad AppSettings cached from a previous run or something. But that seems unlikely since you pass true on the constructor.