This commit is contained in:
max 2024-07-24 23:53:37 +02:00
parent b4c3b5ed18
commit ad2f527de5
2 changed files with 75 additions and 76 deletions

View File

@ -80,7 +80,7 @@ internal static void Compile()
return; return;
} }
Nerfed.Compiler.Compiler.Compile(ProjectFilePath, "Debug"); Compiler.Compiler.Compile(ProjectFilePath, "Debug");
} }
internal static void GenerateSolution() internal static void GenerateSolution()
@ -90,7 +90,7 @@ internal static void GenerateSolution()
return; return;
} }
Nerfed.Compiler.Generator.GenerateSolution(ProjectDirectory, Project, out string solutionFilePath); Compiler.Generator.GenerateSolution(ProjectDirectory, Project, out string solutionFilePath);
ProjectSolutionFilePath = solutionFilePath; ProjectSolutionFilePath = solutionFilePath;
} }
@ -101,35 +101,35 @@ private static void SetupDefaultFolders()
return; return;
} }
string contentPath = Path.Combine(ProjectDirectory, "Content"); string contentDirectory = Path.Combine(ProjectDirectory, "Content");
if (!Directory.Exists(contentPath)) if (!Directory.Exists(contentDirectory))
{ {
Directory.CreateDirectory(contentPath); Directory.CreateDirectory(contentDirectory);
} }
ProjectContentDirectory = contentPath; ProjectContentDirectory = contentDirectory;
string scriptsPath = Path.Combine(ProjectContentDirectory, "Scripts"); string scriptsDirectory = Path.Combine(ProjectContentDirectory, "Scripts");
if (!Directory.Exists(scriptsPath)) 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)) if (!Directory.Exists(scriptsRuntimePath))
{ {
Directory.CreateDirectory(scriptsRuntimePath); Directory.CreateDirectory(scriptsRuntimePath);
} }
// Test create csproject. // Test create csproject.
string gameplayRuntimePath = Path.Combine(scriptsRuntimePath, Compiler.Generator.AssemblyDefinitionExtensionName); string gameplayRuntimeFilePath = Path.Combine(scriptsRuntimePath, Compiler.Generator.AssemblyDefinitionExtensionName);
if (!File.Exists(gameplayRuntimePath)) 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"); string tempDirectory = Path.Combine(ProjectDirectory, "Temp");
if (!Directory.Exists(tempPath)) if (!Directory.Exists(tempDirectory))
{ {
Directory.CreateDirectory(tempPath); Directory.CreateDirectory(tempDirectory);
} }
ProjectTempDirectory = tempPath; ProjectTempDirectory = tempDirectory;
} }
} }

View File

@ -1,68 +1,67 @@
using ImGuiNET; 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; ImGui.Begin("Project");
private static string projectName = string.Empty; ImGui.BeginGroup();
private static string projectFilePath = string.Empty;
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"); EditorProject.Create(newProjectFilePath, projectName);
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();
} }
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();
} }
} }