Search code examples
libgdx

setting up application configuration during runtime


Can we directly make changes for ApplicationConfigurations, while game is running? For example, I have SettingsScreen, and when I press some button for changing to full screen, it will take effect instantly.


Solution

  • Yes, you can.
    To change to fullscreen og change window size while game is running:

         Gdx.graphics.setDisplayMode(int width, int height, boolean fullscreen)
    

    [EDIT]
    sry, I remembered this from an old version.

    It is now:

    Gdx.graphics.setWindowedMode(int x, int y) 
    

    and

    Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode())