|
SleakEngine 1.0.0
C++23 multi-backend game engine
|
#include <CommandLine.hpp>
Static Public Member Functions | |
| static std::string | GetValue (const std::string &flag, const std::string &defaultVal="") |
| Returns the raw string value stored for -flag, or defaultVal if it was not passed. | |
| static bool | HasFlag (const std::string &flag) |
| True if --flag was present on the command line. | |
| static void | Parse (int argc, char **argv) |
| Parses argv into the value/flag tables. Call once from main(), before Application. | |
| static void | SetHelpCallback (void(*callback)(const char *exe)) |
Process-wide command line table. Parse once in main(), read anywhere.
Call Parse(argc, argv) from main() before constructing an Application. The Application reads its window size, title, and graphics backend out of this table, so skipping the call silently disables every launch flag.
Parsing rules:
Engine-recognized flags are -r (backend: vulkan, opengl, d3d11, d3d12), -w and -h (window size), -t (window title, with _ standing in for spaces), and --fullscreen. Game-specific flags are not declared anywhere: just read whatever you like with GetValue("-seed") or HasFlag("--fly") from your own code.
Everything is static and shared for the process.
Definition at line 53 of file CommandLine.hpp.
|
static |
Returns the raw string value stored for -flag, or defaultVal if it was not passed.
Definition at line 43 of file CommandLine.cpp.
|
static |
True if --flag was present on the command line.
Definition at line 49 of file CommandLine.cpp.
|
static |
Parses argv into the value/flag tables. Call once from main(), before Application.
Definition at line 14 of file CommandLine.cpp.
|
static |
Registers the printer invoked for --help. Set it before Parse(); without one, --help is ignored.
Definition at line 10 of file CommandLine.cpp.