2
\$\begingroup\$

I'm writing a small game using Slick and Nifty-GUI.
At the program startup I set the DisplayMode using the following lines:

AppGameContainer app = new ...
app.setDisplayMode( 800, 600, false );
app.start();

I wrote a Nifty-ScreenController for my settings dialog in which the user can select the desired DisplayMode. When I try to set the new DisplayMode within this controller class the game window gets resized correctly but the Graphics and Input objects aren't updated accordingly. Therefore my rendering code just uses a part of the new window.

I tried to set different DisplayModes in the main method to test if it's generally possible to invoke this method multiple times. It seems that changing the DisplayMode only works before I call app.start().

Furthermore I tried to update the Graphics & Input object manually but the init and setDimensions methods are package private. :(

Does someone know what I'm doing wrong and how to change the DisplayMode correctly?

\$\endgroup\$
1
\$\begingroup\$

It looks that you have to use ScalableGame as a wapper for your AppGameContainer if you want to have an scalable window etc. at least thats what I found in the API.

You then can use the recalculateScale() method to update the scale of your game. I suppose you have to set the new DisplayMode before (like you try to do it now).

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.