/* Copyright Alexandre Delcamp-Enache, 2026 Based on vkguide.dev See engine.h for extensive documentation Also, checkout the roadmap */ #define ENGINE_IMPL #include "engine/engine.h" #include "CLI/CLI.hpp" class ArgHandler { public: CLI::App* _run; // All options bool _listGPU {false}; EngineConfig config; void buildArgs() { // Setup // Subcommands _run = _app.add_subcommand("run"); // Main options/flags _app.add_flag("--list-gpu, -l", _listGPU, "Lists available Graphics cards, useful for debugging"); _app.set_version_flag("--version, -v", BUILD_ID); // Help //_app.set_help_all_flag("--help-all", "Expand all help"); _app.set_help_flag(); _app.set_help_all_flag("--help, -h", "Print help for all subcommands"); // Subcommand options/flags // Run _run->add_option("--gpu, -g", config.gpuIndex, "Manually select a GPU"); _run->add_option("--model, -m", config.modelPath, "Overwrites the default model"); } int dispatch(int argc, char* argv[]) { CLI11_PARSE(_app, argc, argv); return 0; } void printHelp() { fmt::println("{}", _app.help()); } private: CLI::App _app; }; int main(int argc, char* argv[]) { // Classes we need Engine engine; ArgHandler handler; // Exemple of overwriting a class value //engine._windowExtent = { 67, 67 }; handler.buildArgs(); if (argc == 1) { handler.printHelp(); fmt::println("Please use -h or --help to see all available options."); return 0; } // Checks for -h flag int result = handler.dispatch(argc, argv); if(result != 0) return result; if (handler._run->parsed() && handler._run->get_help_ptr()->as()) { return 0; } if(handler._listGPU) { engine.getAvailableGPU(); return 0; } if(handler._run->parsed()){ engine.parseConfig( handler.config ); engine.init(); engine.run(); engine.cleanup(); } return 0; }