- Timestamp:
- 03/31/06 17:29:32 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/main.cpp
r709 r721 1 #include <LBBC.h>2 #include <LBBCPrerequisites.h>3 1 4 struct CommandLineOptions 5 { 6 Ogre::String cfg; 7 }; 8 9 int findCommandLineOpts(int numargs, char** argv, Ogre::UnaryOptionList& unaryOptList, 10 Ogre::BinaryOptionList& binOptList) 11 { 12 int startIndex = 1; 13 for (int i = 1; i < numargs; ++i) 14 { 15 Ogre::String tmp(argv[i]); 16 if (Ogre::StringUtil::startsWith(tmp, "-")) 17 { 18 Ogre::UnaryOptionList::iterator ui = unaryOptList.find(argv[i]); 19 if(ui != unaryOptList.end()) 20 { 21 ui->second = true; 22 ++startIndex; 23 continue; 24 } 25 Ogre::BinaryOptionList::iterator bi = binOptList.find(argv[i]); 26 if(bi != binOptList.end()) 27 { 28 bi->second = argv[i+1]; 29 startIndex += 2; 30 ++i; 31 continue; 32 } 33 34 // Invalid option 35 std::cout<<"Invalid option "<<tmp<<std::endl; 36 37 } 38 } 39 return startIndex; 40 } 41 42 CommandLineOptions parseArgs(int numArgs, char **args) 43 { 44 CommandLineOptions opts; 45 46 Ogre::UnaryOptionList unOpt; 47 Ogre::BinaryOptionList binOpt; 48 49 binOpt["-cfg"] = ""; 50 51 int startIndex = findCommandLineOpts(numArgs, args, unOpt, binOpt); 52 Ogre::UnaryOptionList::iterator ui; 53 Ogre::BinaryOptionList::iterator bi; 54 55 bi = binOpt.find("-cfg"); 56 if (!bi->second.empty()) 57 { 58 opts.cfg = bi->second; 59 } 60 61 return opts; 62 } 63 64 void help() 65 { 66 std::cout<<"Please specify the parameter: -cfg sample.cfg"<<std::endl; 67 } 2 #include <IBRBillboardCloudTreeApplication.h> 68 3 69 4 int main(int numargs, char** args) 70 5 { 71 /* 72 if (numargs < 2) 73 { 74 help(); 75 return -1; 76 } 77 */ 78 79 CommandLineOptions opts = parseArgs(numargs, args); 80 81 LBBC::Manager* manager = new LBBC::Manager(); 82 LBBC::Manager::getSingleton().initialize(); 83 84 manager->runSample(Ogre::String(opts.cfg)); 85 86 LBBC::Manager::getSingleton().shutdown(); 87 delete manager; 6 IBRBillboardCloudTreeApplication *app = new IBRBillboardCloudTreeApplication(); 7 app->parseArgs(numargs, args); 8 app->initialize(); 9 delete app; 88 10 89 11 return 0;
Note: See TracChangeset
for help on using the changeset viewer.