Search in sources :

Example 1 with TerasologyEngineBuilder

use of org.terasology.engine.TerasologyEngineBuilder 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 lwjglPortlet = new LwjglPortlet();
        PathManager.getInstance().useDefaultHomePath();
        engine = new TerasologyEngineBuilder().add(new LwjglGraphics()).add(new LwjglTimer()).add(new LwjglAudio()).add(new LwjglInput()).add(lwjglPortlet).build();
        sceneProperties = new SceneProperties(engine);
        mainWindow = new MainWindow(this, engine);
        lwjglPortlet.setCustomViewport(mainWindow.getViewport());
        engine.subscribeToStateChange(mainWindow);
        engine.run(new StateMainMenu());
    } catch (Throwable t) {
        logger.error("Uncaught Exception", t);
    }
}
Also used : LwjglPortlet(org.terasology.engine.subsystem.lwjgl.LwjglPortlet) LwjglAudio(org.terasology.engine.subsystem.lwjgl.LwjglAudio) TerasologyEngineBuilder(org.terasology.engine.TerasologyEngineBuilder) UIManager(javax.swing.UIManager) StateMainMenu(org.terasology.engine.modes.StateMainMenu) SceneProperties(org.terasology.editor.properties.SceneProperties) MainWindow(org.terasology.editor.ui.MainWindow) LwjglTimer(org.terasology.engine.subsystem.lwjgl.LwjglTimer) LwjglInput(org.terasology.engine.subsystem.lwjgl.LwjglInput) LwjglGraphics(org.terasology.engine.subsystem.lwjgl.LwjglGraphics)

Aggregations

UIManager (javax.swing.UIManager)1 SceneProperties (org.terasology.editor.properties.SceneProperties)1 MainWindow (org.terasology.editor.ui.MainWindow)1 TerasologyEngineBuilder (org.terasology.engine.TerasologyEngineBuilder)1 StateMainMenu (org.terasology.engine.modes.StateMainMenu)1 LwjglAudio (org.terasology.engine.subsystem.lwjgl.LwjglAudio)1 LwjglGraphics (org.terasology.engine.subsystem.lwjgl.LwjglGraphics)1 LwjglInput (org.terasology.engine.subsystem.lwjgl.LwjglInput)1 LwjglPortlet (org.terasology.engine.subsystem.lwjgl.LwjglPortlet)1 LwjglTimer (org.terasology.engine.subsystem.lwjgl.LwjglTimer)1