Changeset 940 for code/branches/network/src/orxonox
- Timestamp:
- Mar 27, 2008, 8:22:37 PM (17 years ago)
- Location:
- code/branches/network/src/orxonox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/orxonox/GraphicsEngine.cc
r929 r940 35 35 #include <OgreException.h> 36 36 #include <OgreConfigFile.h> 37 #include <OgreLogManager.h> 37 38 #include <OgreTextureManager.h> 38 39 #include <OgreRenderWindow.h> … … 69 70 { 70 71 SetConfigValue(dataPath_, dataPath_).description("relative path to media data"); 71 72 } 73 72 SetConfigValue(ogreLogfile_, "ogre.log").description("Logfile for messages from Ogre. Use to \"\" to suppress log file creation."); 73 SetConfigValue(ogreLogLevelTrivial_ , 5).description("relative path to media data"); 74 SetConfigValue(ogreLogLevelNormal_ , 4).description("relative path to media data"); 75 SetConfigValue(ogreLogLevelCritical_, 2).description("relative path to media data"); 76 } 77 78 /** 79 @brief Creates the Ogre Root object and sets up the ogre log. 80 */ 74 81 void GraphicsEngine::setup() 75 82 { … … 86 93 std::string plugin_filename = "plugins.cfg"; 87 94 #endif 95 96 // create a logManager 97 LogManager *logger; 98 if(LogManager::getSingletonPtr() == 0) 99 logger = new LogManager(); 100 else 101 logger = LogManager::getSingletonPtr(); 102 103 // create our own log that we can listen to 104 Log *myLog; 105 if (this->ogreLogfile_ == "") 106 myLog = logger->createLog("ogre.log", true, false, true); 107 else 108 myLog = logger->createLog(this->ogreLogfile_, true, false, false); 109 110 myLog->setLogDetail(LL_BOREME); 111 myLog->addListener(this); 112 113 // Root will detect that we've already created a Log 88 114 root_ = new Root(plugin_filename); 89 115 } … … 196 222 } 197 223 224 /** 225 @brief Method called by the LogListener interface from Ogre. 226 We use it to capture Ogre log messages and handle it ourselves. 227 @param message The message to be logged 228 @param lml The message level the log is using 229 @param maskDebug If we are printing to the console or not 230 @param logName the name of this log (so you can have several listeners 231 for different logs, and identify them) 232 */ 233 void GraphicsEngine::messageLogged(const std::string& message, 234 LogMessageLevel lml, bool maskDebug, const std::string &logName) 235 { 236 int orxonoxLevel; 237 switch (lml) 238 { 239 case LML_TRIVIAL: 240 orxonoxLevel = this->ogreLogLevelTrivial_; 241 break; 242 case LML_NORMAL: 243 orxonoxLevel = this->ogreLogLevelNormal_; 244 break; 245 case LML_CRITICAL: 246 orxonoxLevel = this->ogreLogLevelCritical_; 247 break; 248 default: 249 orxonoxLevel = 0; 250 } 251 OutputHandler::getOutStream().setOutputLevel(orxonoxLevel) 252 << "*** Ogre: " << message << std::endl; 253 } 198 254 } -
code/branches/network/src/orxonox/GraphicsEngine.h
r929 r940 11 11 12 12 #include <OgrePrerequisites.h> 13 #include <OgreLog.h> 13 14 #include <OgreRoot.h> 14 15 #include <OgreSceneManager.h> … … 23 24 * graphics engine manager class 24 25 */ 25 class _OrxonoxExport GraphicsEngine : public OrxonoxClass 26 class _OrxonoxExport GraphicsEngine : public OrxonoxClass, public Ogre::LogListener 26 27 { 27 28 public: … … 54 55 55 56 private: 57 //! Method called by the LogListener from Ogre 58 void messageLogged(const std::string& message, Ogre::LogMessageLevel lml, 59 bool maskDebug, const std::string &logName); 60 56 61 Ogre::Root* root_; //!< Ogre's root 57 62 std::string configPath_; //!< path to config file … … 60 65 Ogre::RenderWindow* renderWindow_;//!< the current render window 61 66 //bool bOverwritePath_; //!< overwrites path 67 std::string ogreLogfile_; //!< log file name for Ogre log messages 68 int ogreLogLevelTrivial_; //!< Corresponding Orxonx debug level for LL_TRIVIAL 69 int ogreLogLevelNormal_; //!< Corresponding Orxonx debug level for LL_NORMAL 70 int ogreLogLevelCritical_; //!< Corresponding Orxonx debug level for LL_CRITICAL 62 71 63 72 }; -
code/branches/network/src/orxonox/InputHandler.cc
r934 r940 107 107 COUT(ORX_DEBUG) << "*** InputHandler: Created OIS input system" << std::endl; 108 108 109 // If possible create a buffered keyboard 110 if (inputSystem_->numKeyboards() > 0) 111 { 112 keyboard_ = static_cast<OIS::Keyboard*>(inputSystem_->createInputObject(OIS::OISKeyboard, true)); 113 keyboard_->setEventCallback(this); 114 COUT(ORX_DEBUG) << "*** InputHandler: Created OIS mouse" << std::endl; 115 } 116 117 // If possible create a buffered mouse 118 if (inputSystem_->numMice() > 0 ) 119 { 120 mouse_ = static_cast<OIS::Mouse*>(inputSystem_->createInputObject(OIS::OISMouse, true)); 121 mouse_->setEventCallback(this); 122 COUT(ORX_DEBUG) << "*** InputHandler: Created OIS keyboard" << std::endl; 123 124 // Set mouse region 125 this->setWindowExtents(windowWidth, windowHeight); 126 } 109 // create a keyboard. If none are available the exception is caught. 110 keyboard_ = static_cast<OIS::Keyboard*>(inputSystem_->createInputObject(OIS::OISKeyboard, true)); 111 keyboard_->setEventCallback(this); 112 COUT(ORX_DEBUG) << "*** InputHandler: Created OIS mouse" << std::endl; 113 114 // create a mouse. If none are available the exception is caught. 115 mouse_ = static_cast<OIS::Mouse*>(inputSystem_->createInputObject(OIS::OISMouse, true)); 116 mouse_->setEventCallback(this); 117 COUT(ORX_DEBUG) << "*** InputHandler: Created OIS keyboard" << std::endl; 118 119 // Set mouse region 120 this->setWindowExtents(windowWidth, windowHeight); 127 121 } 128 122 catch (OIS::Exception ex)
Note: See TracChangeset
for help on using the changeset viewer.