Inceptum/src/main/java/io/gitlab/jfronny/glaunch/windows/MainWindow.java

53 lines
1.6 KiB
Java

package io.gitlab.jfronny.glaunch.windows;
import imgui.ImGui;
import imgui.flag.ImGuiWindowFlags;
import imgui.type.ImBoolean;
import io.gitlab.jfronny.glaunch.GLaunch;
public class MainWindow extends Window {
private final ImBoolean darkTheme = new ImBoolean(GLaunch.CONFIG.darkTheme);
private final ImBoolean debugTools = new ImBoolean(false);
public MainWindow() {
super("GLaunch");
}
@Override
public int getFlags() {
return ImGuiWindowFlags.MenuBar | ImGuiWindowFlags.AlwaysAutoResize;
}
@Override
public void draw() {
ImGui.beginMenuBar();
if (ImGui.beginMenu("File")) {
if (ImGui.menuItem("New Instance")) GLaunch.open(new NewInstanceWindow());
if (ImGui.menuItem("Exit GLaunch2")) GLaunch.exit();
ImGui.endMenu();
}
if (ImGui.beginMenu("Settings")) {
if (ImGui.checkbox("Dark Theme", darkTheme)) {
GLaunch.CONFIG.darkTheme = darkTheme.get();
GLaunch.saveConfig();
GLaunch.applyTheme();
}
ImGui.endMenu();
}
if (ImGui.beginMenu("Help")) {
if (ImGui.menuItem("About")) GLaunch.open(new AboutWindow());
if (ImGui.menuItem("Log")) GLaunch.open(new LogWindow());
ImGui.checkbox("Debug Tools", debugTools);
ImGui.endMenu();
}
ImGui.endMenuBar();
if (debugTools.get()) {
ImGui.showDemoWindow();
}
//TODO if no instance
ImGui.text("You have not yet created an instance");
ImGui.text("Use File->New Instance to do so");
}
}