From 04f5688a37030aa8598ded416f05d0cc979c37d6 Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Tue, 19 Dec 2023 13:32:31 -0500 Subject: loading scenes and projects can now be done via args --- src/arg-handler.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/arg-handler.cpp') diff --git a/src/arg-handler.cpp b/src/arg-handler.cpp index 1b40039..2183347 100644 --- a/src/arg-handler.cpp +++ b/src/arg-handler.cpp @@ -1,6 +1,7 @@ #include "arg-handler.hpp" #include "game-settings.hpp" +#include "level.hpp" #include #include @@ -10,11 +11,13 @@ void PkeArgs_Parse(int argc, char *argv[]) { static struct option long_options[] = { {"plugin", required_argument, 0, 'p'}, + {"project", required_argument, 0, 'r'}, + {"scene", required_argument, 0, 's'}, {0, 0, 0, 0}, }; int optionIndex = 0; - int c = getopt_long(argc, argv, "p:", long_options, &optionIndex); + int c = getopt_long(argc, argv, "", long_options, &optionIndex); if (c == -1) { break; } @@ -23,7 +26,16 @@ void PkeArgs_Parse(int argc, char *argv[]) { case 0: break; case 'p': - pkeSettings.pluginPath = optarg; + pkeSettings.args.pluginPath = optarg; + break; + case 'r': + pkeSettings.args.projectPath = optarg; + break; + case 's': + pkeSettings.args.sceneName = optarg; + pkeSettings.rt.shouldLoadScene = true; + pkeSettings.rt.sceneName = pkeSettings.args.sceneName; + pkeSettings.rt.nextLevel = PkeLevel_Create("transient"); break; default: fprintf(stderr, "Unused parameter: %c\n", c); -- cgit v1.2.3