Changeset 1024 for code/trunk/src/orxonox
- Timestamp:
- Apr 10, 2008, 5:35:49 PM (17 years ago)
- Location:
- code/trunk/src/orxonox
- Files:
-
- 23 deleted
- 24 edited
- 7 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/CMakeLists.txt
r1021 r1024 1 1 SET( ORXONOX_SRC_FILES 2 2 GraphicsEngine.cc 3 InputEventListener.cc4 InputHandler.cc5 3 Main.cc 6 4 Orxonox.cc -
code/trunk/src/orxonox/GraphicsEngine.cc
r1021 r1024 35 35 #include <OgreException.h> 36 36 #include <OgreConfigFile.h> 37 #include <OgreLogManager.h> 37 38 #include <OgreTextureManager.h> 38 39 #include <OgreRenderWindow.h> … … 62 63 GraphicsEngine::~GraphicsEngine() 63 64 { 64 if ( !this->root_)65 if (this->root_) 65 66 delete this->root_; 67 // delete the ogre log and the logManager (sine we have created it). 68 if (LogManager::getSingletonPtr() != 0) 69 { 70 LogManager::getSingleton().getDefaultLog()->removeListener(this); 71 LogManager::getSingleton().destroyLog(LogManager::getSingleton().getDefaultLog()); 72 delete LogManager::getSingletonPtr(); 73 } 66 74 } 67 75 68 76 void GraphicsEngine::setConfigValues() 69 77 { 70 SetConfigValue(dataPath_, dataPath_).description("relative path to media data"); 71 72 } 73 78 SetConfigValue(dataPath_, "../../media/").description("relative path to media data"); 79 SetConfigValue(ogreLogfile_, "ogre.log").description("Logfile for messages from Ogre. Use \"\" to suppress log file creation."); 80 SetConfigValue(ogreLogLevelTrivial_ , 5).description("relative path to media data"); 81 SetConfigValue(ogreLogLevelNormal_ , 4).description("relative path to media data"); 82 SetConfigValue(ogreLogLevelCritical_, 2).description("relative path to media data"); 83 } 84 85 /** 86 @brief Creates the Ogre Root object and sets up the ogre log. 87 */ 74 88 void GraphicsEngine::setup() 75 89 { … … 86 100 std::string plugin_filename = "plugins.cfg"; 87 101 #endif 102 103 // create a logManager 104 LogManager *logger; 105 if(LogManager::getSingletonPtr() == 0) 106 logger = new LogManager(); 107 else 108 logger = LogManager::getSingletonPtr(); 109 110 // create our own log that we can listen to 111 Log *myLog; 112 if (this->ogreLogfile_ == "") 113 myLog = logger->createLog("ogre.log", true, false, true); 114 else 115 myLog = logger->createLog(this->ogreLogfile_, true, false, false); 116 117 myLog->setLogDetail(LL_BOREME); 118 myLog->addListener(this); 119 120 // Root will detect that we've already created a Log 88 121 root_ = new Root(plugin_filename); 89 122 } … … 106 139 // temporary overwrite of dataPath, change ini file for permanent change 107 140 if( dataPath != "" ) 108 dataPath_ = dataPath ;141 dataPath_ = dataPath + "/"; 109 142 loadRessourceLocations(this->dataPath_); 110 143 if (!root_->restoreConfig() && !root_->showConfigDialog()) … … 196 229 } 197 230 231 /** 232 @brief Method called by the LogListener interface from Ogre. 233 We use it to capture Ogre log messages and handle it ourselves. 234 @param message The message to be logged 235 @param lml The message level the log is using 236 @param maskDebug If we are printing to the console or not 237 @param logName the name of this log (so you can have several listeners 238 for different logs, and identify them) 239 */ 240 void GraphicsEngine::messageLogged(const std::string& message, 241 LogMessageLevel lml, bool maskDebug, const std::string &logName) 242 { 243 int orxonoxLevel; 244 switch (lml) 245 { 246 case LML_TRIVIAL: 247 orxonoxLevel = this->ogreLogLevelTrivial_; 248 break; 249 case LML_NORMAL: 250 orxonoxLevel = this->ogreLogLevelNormal_; 251 break; 252 case LML_CRITICAL: 253 orxonoxLevel = this->ogreLogLevelCritical_; 254 break; 255 default: 256 orxonoxLevel = 0; 257 } 258 OutputHandler::getOutStream().setOutputLevel(orxonoxLevel) 259 << "*** Ogre: " << message << std::endl; 260 } 198 261 } -
code/trunk/src/orxonox/GraphicsEngine.h
r1021 r1024 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: 28 29 GraphicsEngine(); 29 inlinevoid setConfigPath(std::string path) { this->configPath_ = path; };30 void setConfigPath(std::string path) { this->configPath_ = path; }; 30 31 // find a better way for this 31 32 //inline Ogre::Root* getRoot() { return root_; }; … … 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/trunk/src/orxonox/Main.cc
r1021 r1024 84 84 85 85 orx->start(); 86 orx->destroy ();86 orx->destroySingleton(); 87 87 } 88 88 catch (std::exception &ex) -
code/trunk/src/orxonox/Orxonox.cc
r1021 r1024 50 50 //misc 51 51 //#include "util/Sleep.h" 52 #include "util/ArgReader.h" 52 53 53 54 // audio … … 61 62 62 63 // objects 63 #include "core/ArgReader.h"64 64 #include "core/Debug.h" 65 65 #include "core/Factory.h" … … 70 70 #include "objects/weapon/BulletManager.h" 71 71 72 #include " InputHandler.h"72 #include "core/InputManager.h" 73 73 74 74 #include "Orxonox.h" … … 108 108 delete this->orxonoxHUD_; 109 109 Loader::close(); 110 Input Handler::destroy();110 InputManager::destroySingleton(); 111 111 if (this->auMan_) 112 112 delete this->auMan_; … … 147 147 singletonRef_s = new Orxonox(); 148 148 return singletonRef_s; 149 //static Orxonox theOnlyInstance;150 //return &theOnlyInstance;151 149 } 152 150 … … 154 152 @brief Destroys the Orxonox singleton. 155 153 */ 156 void Orxonox::destroy ()154 void Orxonox::destroySingleton() 157 155 { 158 156 if (singletonRef_s) … … 174 172 std::string mode; 175 173 176 ArgReader ar = ArgReader(argc, argv);174 ArgReader ar(argc, argv); 177 175 ar.checkArgument("mode", mode, false); 178 176 ar.checkArgument("data", this->dataPath_, false); … … 327 325 void Orxonox::setupInputSystem() 328 326 { 329 inputHandler_ = Input Handler::getSingleton();327 inputHandler_ = InputManager::getSingleton(); 330 328 if (!inputHandler_->initialise(ogre_->getWindowHandle(), 331 329 ogre_->getWindowWidth(), ogre_->getWindowHeight())) 332 330 abortImmediate(); 331 inputHandler_->setInputMode(IM_INGAME); 333 332 } 334 333 -
code/trunk/src/orxonox/Orxonox.h
r1021 r1024 17 17 18 18 #include "GraphicsEngine.h" 19 #include " InputEventListener.h"19 #include "core/InputEventListener.h" 20 20 21 21 … … 44 44 45 45 static Orxonox* getSingleton(); 46 static void destroy ();46 static void destroySingleton(); 47 47 48 48 private: … … 75 75 audio::AudioManager* auMan_; //!< audio manager 76 76 BulletManager* bulletMgr_; //!< Keeps track of the thrown bullets 77 Input Handler* inputHandler_; //!< Handles input with key bindings77 InputManager* inputHandler_; //!< Handles input with key bindings 78 78 Ogre::Root* root_; //!< Holy grail of Ogre 79 79 Ogre::Timer* timer_; //!< Main loop timer -
code/trunk/src/orxonox/OrxonoxPlatform.h
r1021 r1024 190 190 191 191 // Integer formats of fixed bit width 192 typedef unsigned int uint32; 192 // FIXME: consider 64 bit platforms! 193 /*typedef unsigned int uint32; 193 194 typedef unsigned short uint16; 194 typedef unsigned char uint8; 195 typedef unsigned char uint8;*/ 195 196 196 197 #ifdef ORXONOX_DOUBLE_PRECISION … … 232 233 // disable: 'MultiTypeString' : multiple assignment operators specified 233 234 // Used in MultiType and works fine so far 234 # pragma warning (disable : 4522)235 //# pragma warning (disable : 4522) 235 236 236 237 // disable: "non dll-interface class used as base for dll-interface class" … … 270 271 } /* namespace orxonox */ 271 272 273 // include visual leak detector to search for memory links 274 //#include <vld.h> 275 272 276 #endif /* _OrxonoxPlatform_H__ */ -
code/trunk/src/orxonox/OrxonoxPrereqs.h
r1021 r1024 27 27 28 28 /** 29 @file OrxonoxPrereqs.h30 @brief Contains all the necessary forward declarations for all classes and structs.31 29 @file 30 @brief Contains all the necessary forward declarations for all classes and structs. 31 */ 32 32 33 33 #ifndef _OrxonoxPrereqs_H__ … … 59 59 //----------------------------------------------------------------------- 60 60 61 // classes that have not yet been put into a namespace 62 class InputManager;63 class SpaceShipSteering;61 namespace orxonox { 62 class GraphicsEngine; 63 class Orxonox; 64 64 65 namespace orxonox { 65 // objects 66 66 class Ambient; 67 class BaseObject;68 67 class Camera; 69 class GraphicsEngine; 70 struct InputEvent; 71 class InputEventListener; 72 class InputHandler; 73 class Mesh; 68 class Explosion; 69 class Fighter; 74 70 class Model; 75 71 class NPC; 76 class OrxListener; 77 class Orxonox; 72 class Projectile; 78 73 class Skybox; 79 74 class SpaceShip; 80 class Tickable;81 class TickFrameListener;82 template <class T>83 class Timer;84 class TimerBase;85 class TimerFrameListener;86 75 class WorldEntity; 87 76 … … 93 82 class WeaponStation; 94 83 84 // tools 85 class BillboardSet; 86 class Light; 87 class Mesh; 88 template <class T> 89 class Timer; 90 class TimerBase; 91 92 // particle 95 93 class ParticleInterface; 94 95 // hud 96 96 class HUD; 97 97 } -
code/trunk/src/orxonox/OrxonoxStableHeaders.h
r1021 r1024 40 40 // including std headers here is useless since they're already precompiled 41 41 42 // not including the entire Ogre.h doesn't exceed the default heap size for pch43 42 #ifndef WIN32_LEAN_AND_MEAN 44 43 // prevent Ogre from including winsock.h that messes with winsock2.h from enet 45 44 # define WIN32_LEAN_AND_MEAN 46 45 #endif 46 // not including the entire Ogre.h doesn't exceed the default heap size for pch 47 47 //#include <Ogre.h> 48 48 #include <OgreBillboardSet.h> -
code/trunk/src/orxonox/core/CMakeLists.txt
r1021 r1024 5 5 Identifier.cc 6 6 IdentifierDistributor.cc 7 InputHandler.cc 8 InputManager.cc 7 9 MetaObjectList.cc 8 10 ConfigValueContainer.cc 9 11 Error.cc 10 12 SignalHandler.cc 11 ArgReader.cc12 13 DebugLevel.cc 13 14 OutputHandler.cc -
code/trunk/src/orxonox/core/CorePrereqs.h
r871 r1024 27 27 28 28 /** 29 @file CorePrereq.h30 @brief Contains all the necessary forward declarations for all classes, structs and enums.29 @file 30 @brief Contains all the necessary forward declarations for all classes and structs. 31 31 */ 32 32 … … 36 36 #include <string> 37 37 38 #include " orxonox/OrxonoxPlatform.h"38 #include "OrxonoxPlatform.h" 39 39 40 40 //----------------------------------------------------------------------- … … 67 67 typedef std::string LanguageEntryLabel; 68 68 69 class ArgReader;70 69 class BaseFactory; 71 70 class BaseMetaObjectListElement; 71 class BaseObject; 72 72 template <class T> 73 73 class ClassFactory; … … 86 86 class Identifier; 87 87 class IdentifierDistributor; 88 class InputHandlerGame; 89 class InputHandlerGUI; 90 class InputManager; 88 91 template <class T> 89 92 class Iterator; … … 103 106 template <class T> 104 107 class SubclassIdentifier; 108 class Tickable; 105 109 template <class T, class O> 106 110 class XMLPortClassObjectContainer; -
code/trunk/src/orxonox/core/Factory.h
r871 r1024 51 51 namespace orxonox 52 52 { 53 class BaseObject; // Forward declaration54 55 53 // ############################### 56 54 // ### Factory ### -
code/trunk/src/orxonox/core/Identifier.h
r890 r1024 33 33 - the name 34 34 - a list with all objects 35 - parents and child s35 - parents and children 36 36 - the factory (if available) 37 37 - the networkID that can be synchronised with the server … … 65 65 namespace orxonox 66 66 { 67 class BaseFactory; // Forward declaration68 class BaseObject; // Forward declaration69 70 67 // ############################### 71 68 // ### Identifier ### -
code/trunk/src/orxonox/core/MetaObjectList.h
r871 r1024 113 113 This allows much faster deletion of objects because no iteration is needed. 114 114 */ 115 class MetaObjectList115 class _CoreExport MetaObjectList 116 116 { 117 117 public: -
code/trunk/src/orxonox/core/Script.cc
r1021 r1024 38 38 } 39 39 40 #include " tolua++.h"41 #include " ../../util/tolua/tolua_bind.h"40 #include "util/tolua/tolua++.h" 41 #include "util/tolua/tolua_bind.h" 42 42 43 43 namespace orxonox … … 57 57 { 58 58 output_ += str; 59 COUT( 0) << "Lua_output!:" << std::endl << str << std::endl << "***" << std::endl;59 COUT(4) << "Lua_output!:" << std::endl << str << std::endl << "***" << std::endl; 60 60 } 61 61 … … 89 89 90 90 if (luaTags) luaSource_ = replaceLuaTags(levelString); 91 COUT( 0) << "ParsedSourceCode: " << luaSource_ << std::endl;91 COUT(4) << "ParsedSourceCode: " << luaSource_ << std::endl; 92 92 } 93 93 … … 100 100 if (error == 0) 101 101 error = lua_pcall(luaState_, 0, 0, 0); 102 if (error != 0) COUT( 0) << "Error in Lua-script: " << lua_tostring(luaState_, -1) << std::endl;102 if (error != 0) COUT(2) << "Error in Lua-script: " << lua_tostring(luaState_, -1) << std::endl; 103 103 } 104 104 -
code/trunk/src/orxonox/core/Tickable.h
r1021 r1024 46 46 namespace orxonox 47 47 { 48 //class TickFrameListener; // Forward declaration49 50 48 //! The Tickable interface provides a tick(dt) function, that gets called every frame. 51 49 class _CoreExport Tickable : virtual public OrxonoxClass -
code/trunk/src/orxonox/objects/Fighter.cc
r1021 r1024 39 39 #include "core/CoreIncludes.h" 40 40 #include "Orxonox.h" 41 #include " InputHandler.h"41 #include "core/InputManager.h" 42 42 #include "particle/ParticleInterface.h" 43 43 #include "weapon/AmmunitionDump.h" … … 255 255 if (!this->setMouseEventCallback_) 256 256 { 257 if (Input Handler::getSingleton()->getMouse())257 if (InputManager::getSingleton()->getMouse()) 258 258 { 259 Input Handler::getSingleton()->getMouse()->setEventCallback(this);259 InputManager::getSingleton()->getMouse()->setEventCallback(this); 260 260 this->setMouseEventCallback_ = true; 261 261 } … … 264 264 WorldEntity::tick(dt); 265 265 266 OIS::Keyboard* mKeyboard = Input Handler::getSingleton()->getKeyboard();267 OIS::Mouse* mMouse = Input Handler::getSingleton()->getMouse();268 269 mKeyboard->capture();270 mMouse->capture();266 OIS::Keyboard* mKeyboard = InputManager::getSingleton()->getKeyboard(); 267 OIS::Mouse* mMouse = InputManager::getSingleton()->getMouse(); 268 269 //mKeyboard->capture(); 270 //mMouse->capture(); 271 271 272 272 if (leftButtonPressed_) -
code/trunk/src/orxonox/objects/Fighter.h
r871 r1024 7 7 8 8 #include "Model.h" 9 10 class TiXmlElement; // Forward declaration11 9 12 10 namespace orxonox -
code/trunk/src/orxonox/objects/Model.h
r1021 r1024 6 6 #include "WorldEntity.h" 7 7 #include "../tools/Mesh.h" 8 9 class TiXmlElement; // Forward declaration10 8 11 9 namespace orxonox -
code/trunk/src/orxonox/objects/NPC.h
r871 r1024 11 11 12 12 #include "Model.h" 13 14 class TiXmlElement; // Forward declaration15 13 16 14 namespace orxonox { -
code/trunk/src/orxonox/objects/Projectile.h
r871 r1024 10 10 namespace orxonox 11 11 { 12 class SpaceShip; // Forward declaration13 14 12 class _OrxonoxExport Projectile : public WorldEntity 15 13 { -
code/trunk/src/orxonox/objects/Skybox.h
r871 r1024 5 5 6 6 #include "core/BaseObject.h" 7 8 class TiXmlElement; // Forward declaration9 7 10 8 namespace orxonox -
code/trunk/src/orxonox/objects/SpaceShip.cc
r1021 r1024 42 42 #include "core/Debug.h" 43 43 #include "Orxonox.h" 44 #include " InputHandler.h"44 #include "core/InputManager.h" 45 45 #include "particle/ParticleInterface.h" 46 46 #include "Projectile.h" … … 417 417 void SpaceShip::tick(float dt) 418 418 { 419 if (!this->setMouseEventCallback_)420 { 421 if (Input Handler::getSingleton()->getMouse())419 if (InputManager::getSingleton()->getMouse()->getEventCallback() != this) 420 { 421 if (InputManager::getSingleton()->getMouse()) 422 422 { 423 Input Handler::getSingleton()->getMouse()->setEventCallback(this);423 InputManager::getSingleton()->getMouse()->setEventCallback(this); 424 424 this->setMouseEventCallback_ = true; 425 425 } … … 446 446 } 447 447 448 OIS::Keyboard* mKeyboard = InputHandler::getSingleton()->getKeyboard(); 449 OIS::Mouse* mMouse = InputHandler::getSingleton()->getMouse(); 450 451 mKeyboard->capture(); 452 mMouse->capture(); 448 OIS::Keyboard* mKeyboard = InputManager::getSingleton()->getKeyboard(); 449 OIS::Mouse* mMouse = InputManager::getSingleton()->getMouse(); 453 450 454 451 -
code/trunk/src/orxonox/objects/SpaceShip.h
r1021 r1024 10 10 #include "../tools/BillboardSet.h" 11 11 12 class TiXmlElement; // Forward declaration13 14 12 namespace orxonox 15 13 { 16 class ParticleInterface; // Forward declaration17 18 14 class _OrxonoxExport SpaceShip : public Model, public OIS::MouseListener 19 15 {
Note: See TracChangeset
for help on using the changeset viewer.