Display modes

Hi,



I have a demo of a simulation I'm working on that seemed to work perfectly, but I wanted to change it to a fullscreen app. I'm using the StandardGame class so I tried to set the app to fullscreen by using the getSettings().setFullscreen(true) method, but it didn't work, I got a:



com.jme.system.JmeException: Bad display mode



error, so I removed the line of code 'getSettings().setFullscreen(true)' recompiled and I still get the same error!! So I can't run anything now, is this a bug? And does anyone know how to fix it?



Thanks

Well, when you change something in the settings like that it is a persistent change, so you didn't just change the setting for that instance it keeps trying to apply fullscreen from now on.  You have two options: getSettings().setFullscreen(false) or getSettings().clear() (I believe that's right, I'm at work so I don't have jME here).



The width, height, and depth need to be adjusted properly if you want to run in fullscreen mode.  It would seem as though whatever the default it is set to is being rejected by your display.

Thanks Darkfrog getSettings().clear() worked a treat  :wink: I wasn't aware that the settings are persistent across runs, I'll keep that in mind.



One more prob though. I've managed to get the jME dialog box to show before the app actually starts so that i can change to fullscreen, but now I'm getting a new error after setting the display settings:



java.lang.IllegalStateException: Provider may only be changed before input is created!

  at com.jme.input.joystick.JoystickInput.setProvider(Unknown Source)

  at com.jmex.game.StandardGame.initSystem(Unknown Source)



I'm using Linux and I've seen warnings whilst running jME about LWJGL not being able to setup a Joystick. Any ideas how to fix this?



Thanks

Well, I'll take a look at why that is throwing an exception, but the jME dialog box (if you're meaning the SHOW_PROPS_DIALOG thing) is not used or supported in StandardGame.  It still is referenced because of it being forced from BaseGame (if I remember correctly) but it shouldn't be used with StandardGame.  Take a look in the tests for TestSwingSettingsEditor (something like that) and it gives an alternative method of modifying settings in StandardGame.  The benefits of this route are that you can do it before the game starts, during game, and even add your own custom settings into the editor.

Got it working now thanks  :slight_smile:



StandardGame is still confusing me a little though, how do I get hold of the LightState? I'm trying to attach lights to the LightState inside a GameState but can't figure out how to get hold of the LightState? In SimpleGame I just had access to LightState is there a method for getting hold of it from within a GameState or StandardGame?



Thanks

StandardGame doesn't touch lighting at all, that is entirely up to the GameState to handle.  I don't think there are any GameStates that include lighting in them apart from DebugGameState (which is a duplication of the functionality in SimpleGame in a GameState).  In premise you should create your own lightstate to work with.