0

Help, i'm trying to make resolution like in Terraria on PC, when it is fullscreen but still windowed. Why this code won't work?

package com.imaginegames.mmgame.desktop;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.imaginegames.mmgame.GameMain;

public class DesktopLauncher {
    public static void main (String[] arg) {
        LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
        config.foregroundFPS = 60;
        config.title = "Millitary Madness";
        config.width = Gdx.graphics.getWidth();
        config.height = Gdx.graphics.getHeight();
        new LwjglApplication(new GameMain(), config);
    }
}

Screen

It says:

Exception in thread "main" java.lang.NullPointerException at com.imaginegames.mmgame.desktop.DesktopLauncher.main(DesktopLauncher.java:13)

leonidsah
  • 1
  • 1
  • you are looking for config.fullscreen=true; You can't get width or height before lwjglapp created. – Deniz Yılmaz Mar 10 '18 at 16:37
  • Ok. Thank you so much. But i still don't understand how to make resolution like in Terraria on PC, and guess why this question marked as duplicate. Anyway, thank you – leonidsah Mar 10 '18 at 23:09

0 Answers0