1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-07 03:12:36 +01:00

rwgame: group command line arguments thematically

New output:
$ ./rwgame --help
I [Game] Build: 815c63cf
Generic options:
  -c [ --config ] PATH     Path of configuration file
  --help                   Show this help message

Window options:
  -w [ --width ] WIDTH     Game resolution width in pixel
  -h [ --height ] HEIGHT   Game resolution height in pixel
  -f [ --fullscreen ]      Enable fullscreen mode

Game options:
  -n [ --newgame ]         Directly start a new game
  -l [ --load ] PATH       Load save file

Developer options:
  -t [ --test ]            Starts a new game in a test location
  -b [ --benchmark ] PATH  Run benchmark from file
This commit is contained in:
Anonymous Maarten 2017-04-26 22:29:02 +02:00 committed by Daniel Evans
parent c5523d6728
commit 6ab7f642ac

View File

@ -28,17 +28,24 @@ GameBase::GameBase(Logger &inlog, int argc, char *argv[]) :
// Define and parse command line options
namespace po = boost::program_options;
po::options_description desc("Available options");
desc.add_options()(
"help", "Show this help message")(
"config,c", po::value<rwfs::path>(), "Path of configuration file")(
"width,w", po::value<size_t>(), "Game resolution width in pixel")(
"height,h", po::value<size_t>(), "Game resolution height in pixel")(
"fullscreen,f", "Enable fullscreen mode")(
"newgame,n", "Directly start a new game")(
po::options_description desc_window("Window options");
desc_window.add_options()(
"width,w", po::value<size_t>()->value_name("WIDTH"), "Game resolution width in pixel")(
"height,h", po::value<size_t>()->value_name("HEIGHT"), "Game resolution height in pixel")(
"fullscreen,f", "Enable fullscreen mode");
po::options_description desc_game("Game options");
desc_game.add_options()(
"newgame,n", "Start a new game")(
"load,l", po::value<std::string>()->value_name("PATH"), "Load save file");
po::options_description desc_devel("Developer options");
desc_devel.add_options()(
"test,t", "Starts a new game in a test location")(
"load,l", po::value<std::string>(), "Load save file")(
"benchmark,b", po::value<std::string>(), "Run benchmark from file");
"benchmark,b", po::value<std::string>()->value_name("PATH"), "Run benchmark from file");
po::options_description desc("Generic options");
desc.add_options()(
"config,c", po::value<rwfs::path>()->value_name("PATH"), "Path of configuration file")(
"help", "Show this help message");
desc.add(desc_window).add(desc_game).add(desc_devel);
po::variables_map &vm = options;
try {