Search in sources :

Example 6 with StateMainMenu

use of org.terasology.engine.modes.StateMainMenu 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

StateMainMenu (org.terasology.engine.modes.StateMainMenu)6 GameEngine (org.terasology.engine.GameEngine)3 ModuleManager (org.terasology.engine.module.ModuleManager)3 EnvironmentSwitchHandler (org.terasology.engine.bootstrap.EnvironmentSwitchHandler)2 Module (org.terasology.module.Module)2 ModuleEnvironment (org.terasology.module.ModuleEnvironment)2 WorldInfo (org.terasology.world.internal.WorldInfo)2 IOException (java.io.IOException)1 Path (java.nio.file.Path)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 Set (java.util.Set)1 UIManager (javax.swing.UIManager)1 SceneProperties (org.terasology.editor.properties.SceneProperties)1 MainWindow (org.terasology.editor.ui.MainWindow)1 ComponentSystemManager (org.terasology.engine.ComponentSystemManager)1 TerasologyEngineBuilder (org.terasology.engine.TerasologyEngineBuilder)1 StateLoading (org.terasology.engine.modes.StateLoading)1 RenderingSubsystemFactory (org.terasology.engine.subsystem.RenderingSubsystemFactory)1 ThreadManager (org.terasology.engine.subsystem.common.ThreadManager)1