Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // read ogre configuration file and extract window dimensions
- int width, height;
- cf.load("ogre.cfg");
- seci = cf.getSectionIterator();
- while(seci.hasMoreElements())
- {
- secName = seci.peekNextKey();
- Ogre::ConfigFile::SettingsMultiMap* settings = seci.getNext();
- Ogre::ConfigFile::SettingsMultiMap::iterator it;
- for(it = settings->begin(); it != settings->end(); ++it)
- {
- typeName = it->first;
- archName = it->second;
- if(typeName == "Video Mode")
- {
- std::size_t split = archName.find("x");
- if(split == Ogre::String::npos)
- throw std::runtime_error("Failed to parse video mode from ogre.cfg");
- width = std::stoi(archName.substr(0, split));
- height = std::stoi(archName.substr(split+1));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement