reone/src/program.h

61 lines
1.6 KiB
C
Raw Normal View History

2020-08-03 01:06:55 +00:00
/*
* Copyright (c) 2020-2021 The reone project contributors
2020-08-03 01:06:55 +00:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
2020-08-02 15:47:59 +00:00
#pragma once
#include <boost/filesystem/path.hpp>
#include <boost/noncopyable.hpp>
2020-08-02 15:47:59 +00:00
#include <boost/program_options/options_description.hpp>
#include "game/options.h"
2020-08-02 15:47:59 +00:00
namespace reone {
/**
2020-12-31 08:11:00 +00:00
* Encapsulates option management. Starts a Game instance.
*
* @see game::Game
2020-08-02 15:47:59 +00:00
*/
class Program : boost::noncopyable {
2020-08-02 15:47:59 +00:00
public:
Program(int argc, char **argv);
2020-12-31 08:11:00 +00:00
/**
* Process command line arguments and start an appropriate Game instance.
*
* @return the exit code
*/
2020-08-02 15:47:59 +00:00
int run();
private:
2020-12-31 08:11:00 +00:00
int _argc;
char **_argv;
2021-04-07 06:51:38 +00:00
boost::program_options::options_description _optsCommon;
boost::program_options::options_description _optsCmdLine { "Usage" };
2020-12-31 08:11:00 +00:00
bool _showHelp { false };
boost::filesystem::path _gamePath;
2021-04-07 06:51:38 +00:00
game::Options _options;
2020-08-02 15:47:59 +00:00
2020-10-01 09:53:36 +00:00
void initOptions();
2020-08-02 15:47:59 +00:00
void loadOptions();
int runGame();
};
} // namespace reone