Changeset 1178
- Timestamp:
- Apr 24, 2008, 4:48:13 PM (17 years ago)
- Location:
- code/branches/console/src/orxonox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/console/src/orxonox/GraphicsEngine.cc
r1090 r1178 40 40 #include <OgreLogManager.h> 41 41 #include <OgreTextureManager.h> 42 #include <OgreRenderWindow.h> 43 42 #include "core/InputManager.h" 44 43 #include "core/CoreIncludes.h" 45 44 #include "core/ConfigValueIncludes.h" … … 90 89 { 91 90 COUT(4) << "*** GraphicsEngine: Destroying objects..." << std::endl; 91 Ogre::WindowEventUtilities::removeWindowEventListener(this->renderWindow_, this); 92 92 if (this->root_) 93 93 delete this->root_; … … 184 184 { 185 185 this->renderWindow_ = root_->initialise(true, "OrxonoxV2"); 186 Ogre::WindowEventUtilities::addWindowEventListener(this->renderWindow_, this); 186 187 Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5); 187 188 //TODO: Do NOT load all the groups, why are we doing that? And do we really do that? initialise != load... … … 289 290 << "*** Ogre: " << message << std::endl; 290 291 } 292 293 void GraphicsEngine::windowMoved(Ogre::RenderWindow *rw){ 294 int w = rw->getWidth(); 295 int h = rw->getHeight(); 296 InputManager::getSingleton().setWindowExtents(w, h); 297 } 298 299 void GraphicsEngine::windowResized(Ogre::RenderWindow *rw){ 300 int w = rw->getWidth(); 301 int h = rw->getHeight(); 302 InputManager::getSingleton().setWindowExtents(w, h); 303 } 304 305 void GraphicsEngine::windowFocusChanged(Ogre::RenderWindow *rw){ 306 int w = rw->getWidth(); 307 int h = rw->getHeight(); 308 InputManager::getSingleton().setWindowExtents(w, h); 309 } 291 310 } -
code/branches/console/src/orxonox/GraphicsEngine.h
r1056 r1178 42 42 #include <OgrePrerequisites.h> 43 43 #include <OgreLog.h> 44 44 #include <OgreRenderWindow.h> 45 #include <OgreWindowEventUtilities.h> 45 46 #include "core/OrxonoxClass.h" 46 47 … … 48 49 namespace orxonox { 49 50 50 /**51 /** 51 52 @brief Graphics engine manager class 52 */53 class _OrxonoxExport GraphicsEngine :public OrxonoxClass, public Ogre::LogListener54 {55 friend class ClassIdentifier<GraphicsEngine>;56 public:57 void setConfigPath(std::string path) { this->configPath_ = path; };58 void setConfigValues();59 void setup();60 bool load(std::string path);61 void loadRessourceLocations(std::string path);62 Ogre::SceneManager* getSceneManager();63 void initialise();64 void destroy();53 */ 54 class _OrxonoxExport GraphicsEngine : public Ogre::WindowEventListener, public OrxonoxClass, public Ogre::LogListener 55 { 56 friend class ClassIdentifier<GraphicsEngine>; 57 public: 58 void setConfigPath(std::string path) { this->configPath_ = path; }; 59 void setConfigValues(); 60 void setup(); 61 bool load(std::string path); 62 void loadRessourceLocations(std::string path); 63 Ogre::SceneManager* getSceneManager(); 64 void initialise(); 65 void destroy(); 65 66 66 // several window properties67 Ogre::RenderWindow* getRenderWindow() { return this->renderWindow_; }68 size_t getWindowHandle();69 int getWindowWidth() const;70 int getWindowHeight() const;67 // several window properties 68 Ogre::RenderWindow* getRenderWindow() { return this->renderWindow_; } 69 size_t getWindowHandle(); 70 int getWindowWidth() const; 71 int getWindowHeight() const; 71 72 72 static GraphicsEngine& getSingleton();73 static GraphicsEngine* getSingletonPtr() { return &getSingleton(); }73 static GraphicsEngine& getSingleton(); 74 static GraphicsEngine* getSingletonPtr() { return &getSingleton(); } 74 75 75 private: 76 // don't mess with singletons 77 GraphicsEngine(); 78 ~GraphicsEngine(); 79 GraphicsEngine(GraphicsEngine&) { } 76 void windowMoved(Ogre::RenderWindow* rw); 77 void windowResized(Ogre::RenderWindow* rw); 78 void windowFocusChanged(Ogre::RenderWindow* rw); 80 79 81 //! Method called by the LogListener from Ogre 82 void messageLogged(const std::string&, Ogre::LogMessageLevel, 83 bool, const std::string&); 80 private: 81 // don't mess with singletons 82 GraphicsEngine(); 83 ~GraphicsEngine(); 84 GraphicsEngine(GraphicsEngine&) { } 84 85 85 Ogre::Root* root_; //!< Ogre's root 86 Ogre::SceneManager* scene_; //!< scene manager of the game 87 Ogre::RenderWindow* renderWindow_;//!< the current render window 88 //bool bOverwritePath_; //!< overwrites path 89 std::string configPath_; //!< path to config file 90 std::string dataPath_; //!< path to data file 91 std::string ogreLogfile_; //!< log file name for Ogre log messages 92 int ogreLogLevelTrivial_; //!< Corresponding Orxonx debug level for LL_TRIVIAL 93 int ogreLogLevelNormal_; //!< Corresponding Orxonx debug level for LL_NORMAL 94 int ogreLogLevelCritical_; //!< Corresponding Orxonx debug level for LL_CRITICAL 86 //! Method called by the LogListener from Ogre 87 void messageLogged(const std::string&, Ogre::LogMessageLevel, 88 bool, const std::string&); 95 89 96 }; 97 90 Ogre::Root* root_; //!< Ogre's root 91 Ogre::SceneManager* scene_; //!< scene manager of the game 92 Ogre::RenderWindow* renderWindow_;//!< the current render window 93 //bool bOverwritePath_; //!< overwrites path 94 std::string configPath_; //!< path to config file 95 std::string dataPath_; //!< path to data file 96 std::string ogreLogfile_; //!< log file name for Ogre log messages 97 int ogreLogLevelTrivial_; //!< Corresponding Orxonx debug level for LL_TRIVIAL 98 int ogreLogLevelNormal_; //!< Corresponding Orxonx debug level for LL_NORMAL 99 int ogreLogLevelCritical_; //!< Corresponding Orxonx debug level for LL_CRITICAL 100 }; 98 101 } 99 102
Note: See TracChangeset
for help on using the changeset viewer.