#include "arg-handler.hpp" #include "game-settings.hpp" #include "level.hpp" #include #include void PkeArgs_Parse(int argc, char *argv[]) { while (1) { 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, "", long_options, &optionIndex); if (c == -1) { break; } switch (c) { case 0: break; case 'p': 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); } } #ifndef NDEBUG if (optind < argc) { fprintf(stdout, "non-option args:\n"); while (optind < argc) { fprintf(stdout, "%s ", argv[optind++]); } fprintf(stdout, "\n"); } #endif }