Time for action — creating a class
Using the previously applied code we are now going to create a class to separate the Ogre code from the main function.
- Create the class
MyApplication
, which has two private pointers, one to a Ogre 3DSceneManager
and the other to theRoot
class:class MyApplication { private: Ogre::SceneManager* _sceneManager; Ogre::Root* _root;
- The rest of this class should be public:
public:
- Create a
loadResources()
function, which loads theresources.cfg
configuration file:void loadResources() { Ogre::ConfigFile cf; cf.load(«resources_d.cfg»);
- Iterate over the sections of the configuration file:
Ogre::ConfigFile::SectionIterator sectionIter = cf.getSectionIterator(); Ogre::String sectionName, typeName, dataname; while (sectionIter.hasMoreElements()) ...
Get Ogre 3D 1.7 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.