use of org.terasology.engine.core.subsystem.lwjgl.LwjglTimer 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());
}
use of org.terasology.engine.core.subsystem.lwjgl.LwjglTimer 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);
}
}
Aggregations