Inceptum/launcher/src/main/java/io/gitlab/jfronny/inceptum/frontend/gui/window/NewInstanceWindow.java

48 lines
1.8 KiB
Java
Raw Normal View History

package io.gitlab.jfronny.inceptum.frontend.gui.window;
2021-10-27 22:00:08 +02:00
2022-01-18 19:22:26 +01:00
import imgui.ImGui;
import io.gitlab.jfronny.inceptum.frontend.gui.control.InstanceManageControls;
import io.gitlab.jfronny.inceptum.util.Utils;
import io.gitlab.jfronny.inceptum.util.install.SetupStepInfo;
import io.gitlab.jfronny.inceptum.util.install.Steps;
2021-10-27 22:00:08 +02:00
import java.io.IOException;
public class NewInstanceWindow extends Window {
private final InstanceManageControls imc = new InstanceManageControls(null, null);
2021-10-27 22:00:08 +02:00
public NewInstanceWindow() {
super("New Instance");
}
@Override
public void draw() {
2022-01-18 19:22:26 +01:00
if (ImGui.beginTabBar("NewInstanceBar")) {
if (ImGui.beginTabItem("New")) {
imc.snapshotsBox();
imc.versionBox(ver -> {});
imc.nameBox("OK", name -> {
try {
GuiUtil.createInstance(new SetupStepInfo(imc.getVersionInfo(),
2022-01-18 19:22:26 +01:00
imc.getLoaderInfo(),
name,
Steps.createProcessState()));
2022-01-18 19:22:26 +01:00
} catch (IOException e) {
Utils.LOGGER.error("Could not initialize instance creation", e);
}
close();
});
ImGui.endTabItem();
2021-10-27 22:00:08 +02:00
}
2022-01-27 17:05:32 +01:00
if (ImGui.beginTabItem("Import")) {
ImGui.text("You can also just add an instance directory and it'll be loaded automatically");
ImGui.text("Using git to manage it is recommended if you do so");
ImGui.spacing();
2022-01-27 17:05:32 +01:00
ImGui.text("Importing CurseForge or Modrinth packs is not yet implemented");
//TODO generic importer based on zip contents and file name ("mrpack")
2022-01-18 19:22:26 +01:00
ImGui.endTabItem();
}
ImGui.endTabBar();
}
2021-10-27 22:00:08 +02:00
}
}