Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. // read ogre configuration file and extract window dimensions
  2.     int width, height;
  3.     cf.load("ogre.cfg");
  4.     seci = cf.getSectionIterator();
  5.     while(seci.hasMoreElements())
  6.     {
  7.         secName = seci.peekNextKey();
  8.         Ogre::ConfigFile::SettingsMultiMap* settings = seci.getNext();
  9.         Ogre::ConfigFile::SettingsMultiMap::iterator it;
  10.         for(it = settings->begin(); it != settings->end(); ++it)
  11.         {
  12.             typeName = it->first;
  13.             archName = it->second;
  14.             if(typeName == "Video Mode")
  15.             {
  16.                 std::size_t split = archName.find("x");
  17.                 if(split == Ogre::String::npos)
  18.                     throw std::runtime_error("Failed to parse video mode from ogre.cfg");
  19.                 width = std::stoi(archName.substr(0, split));
  20.                 height = std::stoi(archName.substr(split+1));
  21.             }
  22.         }
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement