Changeset 1664 for code/branches/gui/src/orxonox/gamestates
- Timestamp:
- Aug 21, 2008, 9:23:11 PM (16 years ago)
- Location:
- code/branches/gui/src/orxonox/gamestates
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/orxonox/gamestates/GSLevel.cc
r1663 r1664 46 46 namespace orxonox 47 47 { 48 SetCommandLineArgument(port, 55556).setShortcut("p") ;49 SetCommandLineArgument(ip, std::string("127.0.0.0"));48 SetCommandLineArgument(port, 55556).setShortcut("p").setInformation("PORT"); 49 SetCommandLineArgument(ip, "127.0.0.0").setInformation("#.#.#.#"); 50 50 51 51 GSLevel::GSLevel() -
code/branches/gui/src/orxonox/gamestates/GSRoot.cc
r1663 r1664 30 30 #include "GSRoot.h" 31 31 32 #include "util/SubString.h" 32 33 #include "core/Factory.h" 33 34 #include "core/ConfigFileManager.h" 34 35 #include "core/ConfigValueIncludes.h" 35 36 #include "core/ConsoleCommand.h" 37 #include "core/CommandLine.h" 36 38 #include "core/Debug.h" 37 39 #include "core/Exception.h" … … 44 46 namespace orxonox 45 47 { 46 SetCommandLineArgument(dataPath, std::string("./"));48 SetCommandLineArgument(dataPath, "").setInformation("PATH"); 47 49 48 50 GSRoot::GSRoot() … … 55 57 GSRoot::~GSRoot() 56 58 { 59 } 60 61 //SetCommandLineArgument(asdf1, "haha").setShortcut("a").setUsageInformation("1|2|3"); 62 //SetCommandLineArgument(asdf2, 3).setShortcut("b"); 63 //SetCommandLineArgument(asdf3, Vector2()).setShortcut("c"); 64 //SetCommandLineArgument(adsf4, 1.4f).setShortcut("d"); 65 //SetCommandLineSwitch(showGraphics).setShortcut("g"); 66 67 void GSRoot::feedCommandLine(int argc, char** argv) 68 { 69 std::vector<std::string> args; 70 for (int i = 1; i < argc; ++i) 71 args.push_back(argv[i]); 72 73 //std::string line = "-a --asdf3 (3,3) -d -5 -b - 5.4"; 74 //SubString tokens(line, " ", " ", false, 92, false, 34, true, 40, 41, false, 0); 75 76 try 77 { 78 orxonox::CommandLine::parse(args); 79 //CommandLine::parse(tokens.getAllStrings()); 80 } 81 catch (orxonox::ArgumentException& ex) 82 { 83 COUT(1) << ex.what() << std::endl; 84 COUT(0) << "Usage:" << std::endl << "orxonox " << CommandLine::getUsageInformation() << std::endl; 85 } 57 86 } 58 87 … … 71 100 this->settings_ = new Settings(); 72 101 73 const CommandLineArgument<std::string>* dataPath = CommandLine::getCommandLineArgument<std::string>("dataPath"); 74 if (!dataPath->hasDefaultValue()) 102 std::string dataPath; 103 CommandLine::getCommandLineValue("dataPath", &dataPath); 104 if (dataPath != "") 75 105 { 76 if (*dataPath ->getValue().end() != '/' && *dataPath->getValue().end() != '\\')77 Settings::tsetDataPath(dataPath ->getValue()+ "/");106 if (*dataPath.end() != '/' && *dataPath.end() != '\\') 107 Settings::tsetDataPath(dataPath + "/"); 78 108 else 79 Settings::tsetDataPath(dataPath ->getValue());109 Settings::tsetDataPath(dataPath); 80 110 } 81 111 … … 91 121 functor->setObject(this); 92 122 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor, "loadGame")); 123 124 requestState("gui"); 93 125 } 94 126 -
code/branches/gui/src/orxonox/gamestates/GSRoot.h
r1663 r1664 41 41 ~GSRoot(); 42 42 43 void feedCommandLine(int argc, char** argv); 43 44 bool tick(float dt); 44 45 void loadGame(const std::string& name);
Note: See TracChangeset
for help on using the changeset viewer.