[SOLVED] Cannot get back from full screen mode

Hi.

I used the code below to set my current game in the full screen mode. After testing the full screen mode, I decided to remove the code. But when I run the game again, it is still in the full screen mode.

Most frustrating is that now when I try running other games in jme, and they are all running in the full screen mode now.:cry:

I think it is important to mention that I am using gtx1050ti card. I don’t have this issue with my other primitive computer.

public static void main(String[] args){
    Main app=new Main();
    
    
    AppSettings settings=new AppSettings(true);
    
    GraphicsDevice device=GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
    DisplayMode[] modes=device.getDisplayModes();
    
    System.out.println("Default : "+device.getDisplayMode().getHeight()+" * "+device.getDisplayMode().getWidth());
    
    for(DisplayMode K: modes)
        System.out.println(K.getHeight()+" * "+K.getWidth()); 
    
    settings.setResolution(device.getDisplayMode().getWidth(), device.getDisplayMode().getHeight());
    settings.setFrequency(device.getDisplayMode().getRefreshRate());
    settings.setFullscreen(device.isFullScreenSupported());
    app.setSettings(settings);
    app.start();
}
1 Like

Settings are stored in your user preferences (on windows in the registry). I think they are keyed using the application title.
So I guess that your applications have the same default title and will share settings and that they do not setFullscreen(false) - so they will just use the value in your preferences (i.e. true).

2 Likes

My question is why would you store a setting made inside a java file that’s intended only for that project in the windows registry?

Edit: To clarify, why is anything stored at all when its a runtime argument that may be changed by simply omitting the argument.

1 Like

So, your suggestion is that we add logic to see if the caller set ANY property and then consider all of the other properties as specifically unset? I think there is danger down that path.

I think OP should be able to fix his problem by setting full screen to false?

ie: replace this line:
settings.setFullscreen(device.isFullScreenSupported());
…with:
settings.setFullscreen(false);

…instead of just removing it.

And if that doesn’t work then we have something to talk about.

An aside: I always love the posts “Here is the code that works… I changed it to something that doesn’t work but I don’t show you that…”

2 Likes

I personally wasn’t aware that changing any setting using the default title, without reversing the setting with an counter argument, would screw up the defaults of the SDK myself.

I don’t know the SDK internals, but when a new project is created, does it start by using AppSettings(true)? Can it be always be started using defaults somehow?

Edit: what about automatically setting the new project title to the project name?

1 Like

Do you have a snippet of Java code that would determine the project name? Any ideas how we would determine that when the game is packaged and installed on a user’s computer as an exe?

I agree that there are some very weird thing with AppSettings… to the point where I have the same 4-5 lines I just cut and paste into every project and change a few literals. But also note there is only so much we can do to keep users from sticking food in their own assholes.

1 Like

I think from a nutritional standpoint, Ill edit the wiki to make a note of changing the title or reversing the settings so you don’t frag defaults of the sdk.

3 Likes

Added warning. If anyone thinks it should be written differently, let me know.
https://jmonkeyengine.github.io/wiki/jme3/intermediate/appsettings.html

2 Likes

I think it’s a good first step. Thanks.

1 Like

Ok. That worked. I added a title and set the fullscreen mode to false. But now the camera has turned upside down.

Some code would be nice. and screen resolution and camera are two different things so I guess u messed it elsewhere. maybe rollback to an older version and do some comparisons could be a way. of course only easily possible with a revision control system like git or the like.

Here is it. I am trying to make the cam look at the object located at the origin.

private void initCam(){
flyCam.setMoveSpeed(10);
cam.setLocation(new Vector3f(0, 5f, 12));
Vector3f camdir=cam.getLocation().subtract(floor.getLocalTranslation());
camdir.normalizeLocal();
cam.lookAt(camdir, Vector3f.UNIT_Y);
}

I think you have those backwards. You are trying to make the camera look at itself.

Edit: see how much easier things are when the broken code is provided to us?

3 Likes

Thank you.

1 Like