From: <vo...@us...> - 2008-08-20 18:14:06
|
Revision: 782 http://opde.svn.sourceforge.net/opde/?rev=782&view=rev Author: volca Date: 2008-08-20 18:14:13 +0000 (Wed, 20 Aug 2008) Log Message: ----------- script loaders added to the root object Modified Paths: -------------- trunk/src/main/Root.cpp trunk/src/main/Root.h Modified: trunk/src/main/Root.cpp =================================================================== --- trunk/src/main/Root.cpp 2008-08-20 18:10:42 UTC (rev 781) +++ trunk/src/main/Root.cpp 2008-08-20 18:14:13 UTC (rev 782) @@ -60,7 +60,9 @@ mDTypeScriptCompiler(NULL), mPLDefScriptCompiler(NULL), mConsoleBackend(NULL), - mServiceMask(serviceMask) { + mServiceMask(serviceMask), + mDTypeScriptLdr(NULL), + mPLDefScriptLdr(NULL) { mLogger = new Logger(); @@ -96,6 +98,10 @@ // ------------------------------------------------------- Root::~Root() { + // if those are used, delete them + delete mDTypeScriptLdr; + delete mPLDefScriptLdr; + delete mDTypeScriptCompiler; delete mPLDefScriptCompiler; @@ -120,10 +126,24 @@ delete mLogger; delete mOgreOpdeLogConnector; + + delete mOgreLogManager; } // ------------------------------------------------------- + void Root::registerCustomScriptLoaders() { + // TODO: bindings + + // the classes register themselves to ogre + if (!mDTypeScriptLdr) + mDTypeScriptLdr = new DTypeScriptLoader(); + + if (!mPLDefScriptLdr) + mPLDefScriptLdr = new PLDefScriptLoader(); + } + + // ------------------------------------------------------- void Root::bootstrapFinished() { // Initialise all resources Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); Modified: trunk/src/main/Root.h =================================================================== --- trunk/src/main/Root.h 2008-08-20 18:10:42 UTC (rev 781) +++ trunk/src/main/Root.h 2008-08-20 18:14:13 UTC (rev 782) @@ -41,6 +41,10 @@ #include "DTypeScriptCompiler.h" #include "PLDefScriptCompiler.h" +// script loaders +#include "DTypeScriptLoader.h" +#include "PLDefScriptLoader.h" + namespace Opde { /** OPDE core class. Used to initialize the whole engine. Singleton */ @@ -88,6 +92,9 @@ /** A shortcut to set loglevel. Valid values are 0-4 */ void setLogLevel(int level); + /// registers custom script loaders with ogre, meaning the custom scripts will get loaded automatically + void registerCustomScriptLoaders(); + protected: /// Registers all the service factories to the Service Manger void registerServiceFactories(); @@ -112,6 +119,12 @@ LogListenerList mLogListeners; const unsigned int mServiceMask; + + /// Loader for the DType scripts. Only used if + DTypeScriptLoader* mDTypeScriptLdr; + + /// Loader for the PLDef scripts + PLDefScriptLoader* mPLDefScriptLdr; }; } // namespace Opde This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |