diff --git a/Nerfed.Editor/Project/Project.cs b/Nerfed.Editor/Project/Project.cs index 84a3c10..07ea370 100644 --- a/Nerfed.Editor/Project/Project.cs +++ b/Nerfed.Editor/Project/Project.cs @@ -80,7 +80,7 @@ internal static void Compile() return; } - Nerfed.Compiler.Compiler.Compile(ProjectFilePath, "Debug"); + Compiler.Compiler.Compile(ProjectFilePath, "Debug"); } internal static void GenerateSolution() @@ -90,7 +90,7 @@ internal static void GenerateSolution() return; } - Nerfed.Compiler.Generator.GenerateSolution(ProjectDirectory, Project, out string solutionFilePath); + Compiler.Generator.GenerateSolution(ProjectDirectory, Project, out string solutionFilePath); ProjectSolutionFilePath = solutionFilePath; } @@ -101,35 +101,35 @@ private static void SetupDefaultFolders() return; } - string contentPath = Path.Combine(ProjectDirectory, "Content"); - if (!Directory.Exists(contentPath)) + string contentDirectory = Path.Combine(ProjectDirectory, "Content"); + if (!Directory.Exists(contentDirectory)) { - Directory.CreateDirectory(contentPath); + Directory.CreateDirectory(contentDirectory); } - ProjectContentDirectory = contentPath; - string scriptsPath = Path.Combine(ProjectContentDirectory, "Scripts"); - if (!Directory.Exists(scriptsPath)) + ProjectContentDirectory = contentDirectory; + string scriptsDirectory = Path.Combine(ProjectContentDirectory, "Scripts"); + if (!Directory.Exists(scriptsDirectory)) { - Directory.CreateDirectory(scriptsPath); + Directory.CreateDirectory(scriptsDirectory); } - string scriptsRuntimePath = Path.Combine(scriptsPath, "Runtime"); + string scriptsRuntimePath = Path.Combine(scriptsDirectory, "Runtime"); if (!Directory.Exists(scriptsRuntimePath)) { Directory.CreateDirectory(scriptsRuntimePath); } // Test create csproject. - string gameplayRuntimePath = Path.Combine(scriptsRuntimePath, Compiler.Generator.AssemblyDefinitionExtensionName); - if (!File.Exists(gameplayRuntimePath)) + string gameplayRuntimeFilePath = Path.Combine(scriptsRuntimePath, Compiler.Generator.AssemblyDefinitionExtensionName); + if (!File.Exists(gameplayRuntimeFilePath)) { - Compiler.AssemblyDefinition.Create(gameplayRuntimePath, "Gameplay", out Compiler.AssemblyDefinition project); + Compiler.AssemblyDefinition.Create(gameplayRuntimeFilePath, "Gameplay", out Compiler.AssemblyDefinition project); } - string tempPath = Path.Combine(ProjectDirectory, "Temp"); - if (!Directory.Exists(tempPath)) + string tempDirectory = Path.Combine(ProjectDirectory, "Temp"); + if (!Directory.Exists(tempDirectory)) { - Directory.CreateDirectory(tempPath); + Directory.CreateDirectory(tempDirectory); } - ProjectTempDirectory = tempPath; + ProjectTempDirectory = tempDirectory; } } \ No newline at end of file diff --git a/Nerfed.Editor/Project/ProjectGui.cs b/Nerfed.Editor/Project/ProjectGui.cs index 25520fd..c866b9f 100644 --- a/Nerfed.Editor/Project/ProjectGui.cs +++ b/Nerfed.Editor/Project/ProjectGui.cs @@ -1,68 +1,67 @@ using ImGuiNET; -namespace Nerfed.Editor.Project +namespace Nerfed.Editor.Project; + +internal static class ProjectGui { - internal static class ProjectGui + private static string projectDirectory = string.Empty; + private static string projectName = string.Empty; + private static string projectFilePath = string.Empty; + + internal static void OnGui() { - private static string projectDirectory = string.Empty; - private static string projectName = string.Empty; - private static string projectFilePath = string.Empty; + ImGui.Begin("Project"); + ImGui.BeginGroup(); - internal static void OnGui() + ImGui.InputText("Project Directory", ref projectDirectory, 512); + ImGui.InputText("Project Name", ref projectName, 512); + + string newProjectFilePath = Path.Combine(projectDirectory, ".project"); + ImGui.Text(newProjectFilePath); + + if (ImGui.Button("Create Project")) { - ImGui.Begin("Project"); - ImGui.BeginGroup(); - - ImGui.InputText("Project Directory", ref projectDirectory, 512); - ImGui.InputText("Project Name", ref projectName, 512); - - string newProjectFilePath = Path.Combine(projectDirectory, ".project"); - ImGui.Text(newProjectFilePath); - - if (ImGui.Button("Create Project")) - { - EditorProject.Create(newProjectFilePath, projectName); - } - - ImGui.EndGroup(); - ImGui.BeginGroup(); - - ImGui.InputText("Project File Path", ref projectFilePath, 512); - if (ImGui.Button("Open Project")) - { - EditorProject.Open(projectFilePath); - } - - ImGui.Text("Loaded project: "); - if(EditorProject.Project != null) - { - ImGui.Text(EditorProject.Project.Name); - ImGui.Text(EditorProject.ProjectFilePath); - ImGui.Text(EditorProject.ProjectSolutionFilePath); - ImGui.Text(EditorProject.ProjectDirectory); - ImGui.Text(EditorProject.ProjectContentDirectory); - ImGui.Text(EditorProject.ProjectTempDirectory); - } - else - { - ImGui.Text("None"); - } - - ImGui.EndGroup(); - ImGui.BeginGroup(); - - if (ImGui.Button("Generate Solution")) - { - EditorProject.GenerateSolution(); - } - - if (ImGui.Button("Compile")) - { - EditorProject.Compile(); - } - - ImGui.EndGroup(); - ImGui.End(); + EditorProject.Create(newProjectFilePath, projectName); } + + ImGui.EndGroup(); + ImGui.BeginGroup(); + + ImGui.InputText("Project File Path", ref projectFilePath, 512); + if (ImGui.Button("Open Project")) + { + EditorProject.Open(projectFilePath); + } + + ImGui.Text("Loaded project: "); + if(EditorProject.Project != null) + { + ImGui.Text(EditorProject.Project.Name); + ImGui.Text(EditorProject.ProjectFilePath); + ImGui.Text(EditorProject.ProjectSolutionFilePath); + ImGui.Text(EditorProject.ProjectDirectory); + ImGui.Text(EditorProject.ProjectContentDirectory); + ImGui.Text(EditorProject.ProjectTempDirectory); + } + else + { + ImGui.Text("None"); + } + + ImGui.EndGroup(); + ImGui.BeginGroup(); + + if (ImGui.Button("Generate Solution")) + { + EditorProject.GenerateSolution(); + } + + if (ImGui.Button("Compile")) + { + EditorProject.Compile(); + } + + ImGui.EndGroup(); + ImGui.End(); } } \ No newline at end of file