diff --git a/Editor/Editor.cpp b/Editor/Editor.cpp index 8fb27fb2..dcee039b 100644 --- a/Editor/Editor.cpp +++ b/Editor/Editor.cpp @@ -112,7 +112,7 @@ int ApplicationMain(int argc, char* argv[]) using namespace Nuake; // Parse launch arguments - const auto arguments = ParseArguments(argc, argv); + const auto& arguments = ParseArguments(argc, argv); LaunchSettings launchSettings = ParseLaunchSettings(arguments); #ifdef NK_DEBUG @@ -133,29 +133,11 @@ int ApplicationMain(int argc, char* argv[]) // Initialize Editor Nuake::EditorInterface editor; - editor.BuildFonts(); // Load project in argument if (!launchSettings.projectPath.empty()) { - FileSystem::SetRootDirectory(FileSystem::GetParentPath(launchSettings.projectPath)); - - auto project = Project::New(); - auto projectFileData = FileSystem::ReadFile(launchSettings.projectPath, true); - try - { - project->Deserialize(json::parse(projectFileData)); - project->FullPath = launchSettings.projectPath; - - Engine::LoadProject(project); - - editor.filesystem->m_CurrentDirectory = Nuake::FileSystem::RootDirectory; - } - catch (std::exception exception) - { - Logger::Log("Error loading project: " + launchSettings.projectPath, "editor", CRITICAL); - Logger::Log(exception.what()); - } + editor.LoadProject(launchSettings.projectPath); } // Start application main loop diff --git a/Editor/src/Windows/EditorInterface.cpp b/Editor/src/Windows/EditorInterface.cpp index 4a835397..75e302c6 100644 --- a/Editor/src/Windows/EditorInterface.cpp +++ b/Editor/src/Windows/EditorInterface.cpp @@ -61,6 +61,8 @@ namespace Nuake { filesystem = new FileSystemUI(this); _WelcomeWindow = new WelcomeWindow(this); _audioWindow = new AudioWindow(); + + BuildFonts(); } void EditorInterface::Init() @@ -1675,4 +1677,30 @@ namespace Nuake { return entityTypeName; } + + bool EditorInterface::LoadProject(const std::string& projectPath) + { + FileSystem::SetRootDirectory(FileSystem::GetParentPath(projectPath)); + + auto project = Project::New(); + auto projectFileData = FileSystem::ReadFile(projectPath, true); + try + { + project->Deserialize(json::parse(projectFileData)); + project->FullPath = projectPath; + + Engine::LoadProject(project); + + filesystem->m_CurrentDirectory = Nuake::FileSystem::RootDirectory; + } + catch (std::exception exception) + { + Logger::Log("Error loading project: " + projectPath, "editor", CRITICAL); + Logger::Log(exception.what()); + return false; + } + + return true; + } + } diff --git a/Editor/src/Windows/EditorInterface.h b/Editor/src/Windows/EditorInterface.h index 46b1dacb..595f89ab 100644 --- a/Editor/src/Windows/EditorInterface.h +++ b/Editor/src/Windows/EditorInterface.h @@ -61,6 +61,7 @@ namespace Nuake bool ShouldDrawAxis() const { return m_DrawAxis; } bool ShouldDrawCollision() const { return m_DebugCollisions; } + bool LoadProject(const std::string& projectPath); private: std::string GetEntityTypeName(const Entity& entity) const; diff --git a/Nuake/dependencies/freetype_p5.lua b/Nuake/dependencies/freetype_p5.lua index 937fb89f..17f4f0a4 100644 --- a/Nuake/dependencies/freetype_p5.lua +++ b/Nuake/dependencies/freetype_p5.lua @@ -68,10 +68,15 @@ project "Freetype" filter "configurations:Debug" files { "freetype/src/base/ftdebug.c" } - runtime "Debug" - symbols "on" + runtime "Debug" + symbols "on" filter "configurations:Release" files { "freetype/src/base/ftdebug.c" } - runtime "Release" - optimize "on" \ No newline at end of file + runtime "Release" + optimize "on" + + filter "configurations:Dist" + files { "freetype/src/base/ftdebug.c" } + runtime "Release" + optimize "on" \ No newline at end of file diff --git a/Nuake/dependencies/jolt_p5.lua b/Nuake/dependencies/jolt_p5.lua index 95001c48..6961997d 100644 --- a/Nuake/dependencies/jolt_p5.lua +++ b/Nuake/dependencies/jolt_p5.lua @@ -36,6 +36,11 @@ project 'JoltPhysics' symbols "on" filter "configurations:Release" + cppdialect "C++17" + runtime "Release" + optimize "on" + + filter "configurations:Dist" cppdialect "C++17" runtime "Release" optimize "on" \ No newline at end of file