#include #include #include #include #include #include #include "src/Windows/EditorInterface.h" #include #include #include #include #include "src/Scene/Components/BoxCollider.h" #include #include #include #include #include #include #include "src/UI/UserInterface.h" #include "src/NewEditor.h" #include #include "src/Actions/EditorSelection.h" #include "src/Misc/GizmoDrawer.h" #include "src/Windows/FileSystemUI.h" #include "src/Core/Maths.h" #include "src/Rendering/SceneRenderer.h" #include "src/Misc/WindowTheming.h" #include "src/Application/Application.h" #include "src/Application/EntryPoint.h" #include "src/EditorApplication.h" struct LaunchSettings { int32_t monitor = -1; Vector2 resolution = { 1920, 1080 }; std::string windowTitle = "Nuake Editor "; std::string projectPath; }; std::vector ParseArguments(int argc, char* argv[]) { std::vector args; for (uint32_t i = 0; i < argc; i++) { args.push_back(std::string(argv[i])); } return args; } LaunchSettings ParseLaunchSettings(const std::vector& arguments) { LaunchSettings launchSettings; const auto argumentSize = arguments.size(); size_t i = 0; for (const auto& arg : arguments) { const size_t nextArgumentIndex = i + 1; const bool containsAnotherArgument = nextArgumentIndex <= argumentSize; if (arg == "--project") { if (!containsAnotherArgument) { continue; } // Load project on start std::string projectPath = arguments[i + 1]; launchSettings.projectPath = projectPath; } else if (arg == "--resolution") { if (!containsAnotherArgument) { continue; } // Set editor window resolution std::string resString = arguments[i + 1]; const auto& resSplits = String::Split(resString, 'x'); if (resSplits.size() == 2) { int width = stoi(resSplits[0]); int height = stoi(resSplits[1]); launchSettings.resolution = Vector2(width, height); } } else if (arg == "--monitor") { // Set editor window monitor if (containsAnotherArgument) { launchSettings.monitor = stoi(arguments[i + 1]); } } i++; } return launchSettings; } Nuake::Application* Nuake::CreateApplication(int argc, char** argv) { using namespace Nuake; const auto& arguments = ParseArguments(argc, argv); LaunchSettings launchSettings = ParseLaunchSettings(arguments); ApplicationSpecification specification { .Name = "Editor", .WindowWidth = 1600, .WindowHeight = 900, .VSync = true }; #ifdef NK_DEBUG specification.Name += "(DEBUG BUILD)"; #endif return new EditorApplication(specification); }