Changeset 159 for code/branches/main_reto_vs05/src/ogre_control.cc
- Timestamp:
- Nov 3, 2007, 11:06:43 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/main_reto_vs05/src/ogre_control.cc
r157 r159 26 26 */ 27 27 28 /** 29 * Ogre control class. 30 * This is merely a convenient way to handle Ogre. It only holds the Root 31 * object and the render Window. These are the objects, that are independant 32 * of the game state (playing, menu browsing, loading, etc.). 33 * This class could easily be merged into the Orxnox class. 34 */ 35 36 28 37 #include "ogre_control.h" 29 38 30 39 40 /** 41 * Provide support for mac users. 42 */ 31 43 #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE 32 44 // This function will locate the path to our application on OS X, … … 56 68 57 69 58 OgreControl::OgreControl() 59 { 60 mRoot = 0; 70 /** 71 * Constructor that determines the resource path platform dependant. 72 */ 73 OgreControl::OgreControl() : root_(0) 74 { 61 75 // Provide a nice cross platform solution for locating the configuration 62 76 // files. On windows files are searched for in the current working … … 64 78 // function macBundlePath does this for us. 65 79 #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE 66 mResourcePath= macBundlePath() + "/Contents/Resources/";80 resourcePath_ = macBundlePath() + "/Contents/Resources/"; 67 81 #else 68 mResourcePath = ""; 69 #endif 70 } 71 72 73 // standard destructor 82 resourcePath_ = ""; 83 #endif 84 } 85 86 87 /** 88 * Standard Destructor. 89 */ 74 90 OgreControl::~OgreControl() 75 91 { 76 if (mRoot) 77 delete mRoot; 78 } 79 80 81 /**------------- SETTING UP OGRE --------------**/ 82 92 if (root_) 93 delete root_; 94 } 95 96 97 /* Sets up Ogre. 98 * First, the Root object is being created, then the resources are defined 99 * (not loaded!). And last but not least, the render settings (like resolution 100 * or AA level) are prompted to the user. 101 */ 83 102 bool OgreControl::initialise(void) 84 103 { … … 86 105 // only use plugins.cfg if not static 87 106 #ifndef OGRE_STATIC_LIB 88 pluginsPath = mResourcePath+ "plugins.cfg";89 #endif 90 91 mRoot= new Root(pluginsPath,92 mResourcePath + "ogre.cfg", mResourcePath+ "Ogre.log");107 pluginsPath = resourcePath_ + "plugins.cfg"; 108 #endif 109 110 root_ = new Root(pluginsPath, 111 resourcePath_ + "ogre.cfg", resourcePath_ + "Ogre.log"); 93 112 94 113 setupResources(); … … 101 120 102 121 103 // Method which will define the source of resources 104 // (other than current folder) 122 /** 123 * Defines the source of the resources. 124 */ 105 125 void OgreControl::setupResources(void) 106 126 { 107 127 // Load resource paths from config file 108 128 ConfigFile cf; 109 cf.load( mResourcePath+ "resources.cfg");129 cf.load(resourcePath_ + "resources.cfg"); 110 130 111 131 // Go through all sections & settings in the file … … 137 157 138 158 159 /** 160 * Prompts a setting window for the render engine if that has not already 161 * been done. 162 * The method also calls the root initialiser in order to get a render window. 163 */ 139 164 bool OgreControl::configure(void) 140 165 { … … 142 167 // You can skip this and use root.restoreConfig() to load configuration 143 168 // settings if you were sure there are valid ones saved in ogre.cfg 144 if(! mRoot->restoreConfig() && !mRoot->showConfigDialog())169 if(!root_->restoreConfig() && !root_->showConfigDialog()) 145 170 return false; 146 171 … … 148 173 // Here we choose to let the system create a default 149 174 // rendering window by passing 'true' 150 mWindow = mRoot->initialise(true);151 mRoot->saveConfig();175 root_->saveConfig(); 176 window_ = root_->initialise(true); 152 177 return true; 153 178 } 154 179 155 180 181 /** 182 * Returns the root object. 183 * @return Root object. 184 */ 156 185 Root* OgreControl::getRoot(void) 157 186 { 158 return mRoot; 159 } 160 161 187 return root_; 188 } 189 190 191 /** 192 * Returns the render window. 193 * @return Render window. 194 */ 162 195 RenderWindow* OgreControl::getRenderWindow(void) 163 196 { 164 return mWindow; 165 } 166 167 197 return window_; 198 } 199 200 201 /** 202 * Returns the resource path. 203 * @return Resource path. 204 */ 168 205 Ogre::String OgreControl::getResourcePath(void) 169 206 { 170 return mResourcePath;171 } 207 return resourcePath_; 208 }
Note: See TracChangeset
for help on using the changeset viewer.