Search in sources :

Example 1 with Lwjgl3WindowConfiguration

use of com.badlogic.gdx.backends.lwjgl3.Lwjgl3WindowConfiguration in project gaiasky by langurmonkey.

the class GaiaSky method render.

@Override
public void render() {
    try {
        if (running.get() && !crashed.get()) {
            // Run the render process
            renderProcess.run();
            // Run parked runnables
            synchronized (parkedRunnables) {
                if (parkedRunnables.size() > 0) {
                    Iterator<Runnable> it = parkedRunnables.iterator();
                    while (it.hasNext()) {
                        Runnable r = it.next();
                        try {
                            r.run();
                        } catch (Exception e) {
                            logger.error(e);
                            // If it crashed, remove it
                            it.remove();
                        }
                    }
                }
            }
        } else if (crashGui != null) {
            // Crash information
            renderGui(crashGui);
        }
    } catch (Throwable t) {
        // Report the crash
        CrashReporter.reportCrash(t, logger);
        // Set up crash window
        crashGui = new CrashGui(globalResources.getSkin(), graphics, 1f / settings.program.ui.scale, t);
        crashGui.initialize(assetManager, globalResources.getSpriteBatch());
        Gdx.input.setInputProcessor(crashGui.getGuiStage());
        // Flag up
        crashed.set(true);
    }
    // Create UI window if needed
    if (externalView && gaiaSkyView == null) {
        postRunnable(() -> {
            // Create window
            Lwjgl3Application app = (Lwjgl3Application) Gdx.app;
            Lwjgl3WindowConfiguration config = new Lwjgl3WindowConfiguration();
            config.setWindowPosition(0, 0);
            config.setWindowedMode(graphics.getWidth(), graphics.getHeight());
            config.setTitle(settings.APPLICATION_NAME + " - External view");
            config.useVsync(false);
            config.setWindowIcon(Files.FileType.Internal, "icon/gs_icon.png");
            gaiaSkyView = new GaiaSkyView(globalResources.getSkin(), globalResources.getSpriteShader());
            Lwjgl3Window newWindow = app.newWindow(gaiaSkyView, config);
            gaiaSkyView.setWindow(newWindow);
        });
    }
}
Also used : Lwjgl3Window(com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window) Lwjgl3WindowConfiguration(com.badlogic.gdx.backends.lwjgl3.Lwjgl3WindowConfiguration) Lwjgl3Application(com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application)

Aggregations

Lwjgl3Application (com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application)1 Lwjgl3Window (com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window)1 Lwjgl3WindowConfiguration (com.badlogic.gdx.backends.lwjgl3.Lwjgl3WindowConfiguration)1