Nerfed/Nerfed.Editor/Project/ProjectGui.cs

68 lines
2.0 KiB
C#
Raw Normal View History

2024-07-19 15:24:50 +02:00
using ImGuiNET;
namespace Nerfed.Editor.Project
{
internal static class ProjectGui
{
2024-07-24 21:40:10 +02:00
private static string projectDirectory = string.Empty;
2024-07-19 15:24:50 +02:00
private static string projectName = string.Empty;
2024-07-21 14:03:40 +02:00
private static string projectFilePath = string.Empty;
2024-07-19 15:24:50 +02:00
internal static void OnGui()
{
ImGui.Begin("Project");
2024-07-21 14:03:40 +02:00
ImGui.BeginGroup();
2024-07-19 15:24:50 +02:00
2024-07-24 21:40:10 +02:00
ImGui.InputText("Project Directory", ref projectDirectory, 512);
2024-07-19 15:24:50 +02:00
ImGui.InputText("Project Name", ref projectName, 512);
2024-07-24 21:40:10 +02:00
string newProjectFilePath = Path.Combine(projectDirectory, ".project");
2024-07-21 14:03:40 +02:00
ImGui.Text(newProjectFilePath);
2024-07-19 15:24:50 +02:00
if (ImGui.Button("Create Project"))
{
2024-07-21 14:03:40 +02:00
EditorProject.Create(newProjectFilePath, projectName);
2024-07-19 15:24:50 +02:00
}
2024-07-21 14:03:40 +02:00
ImGui.EndGroup();
ImGui.BeginGroup();
ImGui.InputText("Project File Path", ref projectFilePath, 512);
if (ImGui.Button("Open Project"))
2024-07-19 15:24:50 +02:00
{
2024-07-21 14:03:40 +02:00
EditorProject.Open(projectFilePath);
2024-07-19 15:24:50 +02:00
}
ImGui.Text("Loaded project: ");
2024-07-21 14:03:40 +02:00
if(EditorProject.Project != null)
2024-07-19 15:24:50 +02:00
{
2024-07-21 14:03:40 +02:00
ImGui.Text(EditorProject.Project.Name);
ImGui.Text(EditorProject.ProjectFilePath);
ImGui.Text(EditorProject.ProjectSolutionFilePath);
2024-07-24 21:40:10 +02:00
ImGui.Text(EditorProject.ProjectDirectory);
ImGui.Text(EditorProject.ProjectContentDirectory);
ImGui.Text(EditorProject.ProjectTempDirectory);
2024-07-19 15:24:50 +02:00
}
else
{
ImGui.Text("None");
}
2024-07-21 14:03:40 +02:00
ImGui.EndGroup();
ImGui.BeginGroup();
if (ImGui.Button("Generate Solution"))
{
EditorProject.GenerateSolution();
}
if (ImGui.Button("Compile"))
{
EditorProject.Compile();
}
ImGui.EndGroup();
2024-07-19 15:24:50 +02:00
ImGui.End();
}
}
}