Search in sources :

Example 1 with LwjglAudio

use of org.terasology.engine.core.subsystem.lwjgl.LwjglAudio in project Terasology by MovingBlocks.

the class Terasology method populateSubsystems.

private void populateSubsystems(TerasologyEngineBuilder builder) {
    if (isHeadless) {
        builder.add(new HeadlessGraphics()).add(new HeadlessTimer()).add(new HeadlessAudio());
    } else {
        EngineSubsystem audio = soundEnabled ? new LwjglAudio() : new HeadlessAudio();
        builder.add(audio).add(new LwjglGraphics()).add(new LwjglTimer()).add(new LwjglInput()).add(new BindsSubsystem()).add(new OpenVRInput());
        builder.add(new DiscordRPCSubSystem());
    }
    builder.add(new HibernationSubsystem());
}
Also used : LwjglAudio(org.terasology.engine.core.subsystem.lwjgl.LwjglAudio) HeadlessTimer(org.terasology.engine.core.subsystem.headless.HeadlessTimer) BindsSubsystem(org.terasology.engine.core.subsystem.config.BindsSubsystem) HeadlessGraphics(org.terasology.engine.core.subsystem.headless.HeadlessGraphics) EngineSubsystem(org.terasology.engine.core.subsystem.EngineSubsystem) OpenVRInput(org.terasology.engine.core.subsystem.openvr.OpenVRInput) LwjglTimer(org.terasology.engine.core.subsystem.lwjgl.LwjglTimer) LwjglInput(org.terasology.engine.core.subsystem.lwjgl.LwjglInput) LwjglGraphics(org.terasology.engine.core.subsystem.lwjgl.LwjglGraphics) HeadlessAudio(org.terasology.engine.core.subsystem.headless.HeadlessAudio) DiscordRPCSubSystem(org.terasology.subsystem.discordrpc.DiscordRPCSubSystem) HibernationSubsystem(org.terasology.engine.core.subsystem.common.hibernation.HibernationSubsystem)

Example 2 with LwjglAudio

use of org.terasology.engine.core.subsystem.lwjgl.LwjglAudio in project Terasology by MovingBlocks.

the class TeraEd method run.

public void run() {
    JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    try {
        for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception e) {
        // If Nimbus is not available, you can set the GUI to another look and feel.
        logger.warn("Failed to set look and feel to Nimbus", e);
    }
    try {
        LwjglPortlet portlet = new LwjglPortlet();
        PathManager.getInstance().useDefaultHomePath();
        engine = new TerasologyEngineBuilder().add(new LwjglTimer()).add(new LwjglAudio()).add(new AwtInput()).add(new BindsSubsystem()).add(portlet).build();
        if (!GLFW.glfwInit()) {
            throw new RuntimeException("Failed to initialize GLFW");
        }
        sceneProperties = new SceneProperties(engine);
        mainWindow = new MainWindow(this, engine);
        portlet.createCanvas();
        AWTGLCanvas canvas = portlet.getCanvas();
        engine.subscribeToStateChange(mainWindow);
        engine.initializeRun(new StateMainMenu());
        mainWindow.getViewport().setTerasology(canvas);
        portlet.initInputs();
        Runnable renderLoop = new Runnable() {

            public void run() {
                if (canvas.isValid()) {
                    canvas.render();
                }
                SwingUtilities.invokeLater(this);
            }
        };
        // Setup swing thread as game thread
        PerformanceMonitor.startActivity("Other");
        SwingUtilities.invokeAndWait(portlet::setupThreads);
        SwingUtilities.invokeLater(renderLoop);
        PerformanceMonitor.endActivity();
    } catch (Throwable t) {
        logger.error("Uncaught Exception", t);
    }
}
Also used : LwjglPortlet(org.terasology.editor.subsystem.LwjglPortlet) LwjglAudio(org.terasology.engine.core.subsystem.lwjgl.LwjglAudio) TerasologyEngineBuilder(org.terasology.engine.core.TerasologyEngineBuilder) UIManager(javax.swing.UIManager) AwtInput(org.terasology.editor.subsystem.AwtInput) BindsSubsystem(org.terasology.engine.core.subsystem.config.BindsSubsystem) StateMainMenu(org.terasology.engine.core.modes.StateMainMenu) SceneProperties(org.terasology.editor.properties.SceneProperties) MainWindow(org.terasology.editor.ui.MainWindow) LwjglTimer(org.terasology.engine.core.subsystem.lwjgl.LwjglTimer) AWTGLCanvas(org.lwjgl.opengl.awt.AWTGLCanvas)

Aggregations

BindsSubsystem (org.terasology.engine.core.subsystem.config.BindsSubsystem)2 LwjglAudio (org.terasology.engine.core.subsystem.lwjgl.LwjglAudio)2 LwjglTimer (org.terasology.engine.core.subsystem.lwjgl.LwjglTimer)2 UIManager (javax.swing.UIManager)1 AWTGLCanvas (org.lwjgl.opengl.awt.AWTGLCanvas)1 SceneProperties (org.terasology.editor.properties.SceneProperties)1 AwtInput (org.terasology.editor.subsystem.AwtInput)1 LwjglPortlet (org.terasology.editor.subsystem.LwjglPortlet)1 MainWindow (org.terasology.editor.ui.MainWindow)1 TerasologyEngineBuilder (org.terasology.engine.core.TerasologyEngineBuilder)1 StateMainMenu (org.terasology.engine.core.modes.StateMainMenu)1 EngineSubsystem (org.terasology.engine.core.subsystem.EngineSubsystem)1 HibernationSubsystem (org.terasology.engine.core.subsystem.common.hibernation.HibernationSubsystem)1 HeadlessAudio (org.terasology.engine.core.subsystem.headless.HeadlessAudio)1 HeadlessGraphics (org.terasology.engine.core.subsystem.headless.HeadlessGraphics)1 HeadlessTimer (org.terasology.engine.core.subsystem.headless.HeadlessTimer)1 LwjglGraphics (org.terasology.engine.core.subsystem.lwjgl.LwjglGraphics)1 LwjglInput (org.terasology.engine.core.subsystem.lwjgl.LwjglInput)1 OpenVRInput (org.terasology.engine.core.subsystem.openvr.OpenVRInput)1 DiscordRPCSubSystem (org.terasology.subsystem.discordrpc.DiscordRPCSubSystem)1