Search in sources :

Example 1 with HeadlessApplication

use of com.badlogic.gdx.backends.headless.HeadlessApplication in project Mindustry by Anuken.

the class ServerLauncher method main.

public static void main(String[] args) throws Exception {
    Net.setClientProvider(new KryoClient());
    Net.setServerProvider(new KryoServer());
    new HeadlessApplication(new MindustryServer());
    // find and handle uncaught exceptions in libGDX thread
    for (Thread thread : Thread.getAllStackTraces().keySet()) {
        if (thread.getName().equals("HeadlessApplication")) {
            thread.setUncaughtExceptionHandler((t, throwable) -> {
                throwable.printStackTrace();
                System.exit(-1);
            });
            break;
        }
    }
}
Also used : KryoServer(io.anuke.kryonet.KryoServer) HeadlessApplication(com.badlogic.gdx.backends.headless.HeadlessApplication) KryoClient(io.anuke.kryonet.KryoClient)

Example 2 with HeadlessApplication

use of com.badlogic.gdx.backends.headless.HeadlessApplication in project ProjektGG by eskalon.

the class LibgdxUnitTest method init.

@BeforeAll
public static void init() {
    application = new HeadlessApplication(new ApplicationAdapter() {
    });
    // Use Mockito to mock the OpenGL methods since we are running
    // headlessly
    Gdx.gl20 = Mockito.mock(GL20.class);
    Gdx.gl = Gdx.gl20;
}
Also used : GL20(com.badlogic.gdx.graphics.GL20) ApplicationAdapter(com.badlogic.gdx.ApplicationAdapter) HeadlessApplication(com.badlogic.gdx.backends.headless.HeadlessApplication) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 3 with HeadlessApplication

use of com.badlogic.gdx.backends.headless.HeadlessApplication in project ProjektGG by eskalon.

the class LibgdxUnitTest method init.

@BeforeAll
public static void init() {
    application = new HeadlessApplication(new ApplicationAdapter() {
    });
    // Use Mockito to mock the OpenGL methods since we are running
    // headlessly
    Gdx.gl20 = Mockito.mock(GL20.class);
    Gdx.gl = Gdx.gl20;
}
Also used : GL20(com.badlogic.gdx.graphics.GL20) ApplicationAdapter(com.badlogic.gdx.ApplicationAdapter) HeadlessApplication(com.badlogic.gdx.backends.headless.HeadlessApplication) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

HeadlessApplication (com.badlogic.gdx.backends.headless.HeadlessApplication)3 ApplicationAdapter (com.badlogic.gdx.ApplicationAdapter)2 GL20 (com.badlogic.gdx.graphics.GL20)2 BeforeAll (org.junit.jupiter.api.BeforeAll)2 KryoClient (io.anuke.kryonet.KryoClient)1 KryoServer (io.anuke.kryonet.KryoServer)1