diff --git a/gui/manager.cpp b/gui/manager.cpp index 564a33cfed..b606d7d16f 100644 --- a/gui/manager.cpp +++ b/gui/manager.cpp @@ -6,7 +6,7 @@ using namespace OEngine::GUI; -void MyGUIManager::setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool logging) +void MyGUIManager::setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool logging, const std::string& logDir) { assert(wnd); assert(mgr); @@ -21,13 +21,17 @@ void MyGUIManager::setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool LogManager::initialise(); LogManager::setSTDOutputEnabled(logging); + std::string theLogFile = std::string(MYGUI_PLATFORM_LOG_FILENAME); + if(!logDir.empty()) + theLogFile.insert(0, logDir); + // Set up OGRE platform. We might make this more generic later. mPlatform = new OgrePlatform(); - mPlatform->initialise(wnd, mgr); + mPlatform->initialise(wnd, mgr, "General", theLogFile); // Create GUI mGui = new Gui(); - mGui->initialise(); + mGui->initialise("core.xml", theLogFile); } void MyGUIManager::shutdown() diff --git a/gui/manager.hpp b/gui/manager.hpp index e59b4b54bd..781685acfe 100644 --- a/gui/manager.hpp +++ b/gui/manager.hpp @@ -23,11 +23,11 @@ namespace GUI public: MyGUIManager() : mPlatform(NULL), mGui(NULL) {} - MyGUIManager(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool logging=false) - { setup(wnd,mgr,logging); } + MyGUIManager(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool logging=false, const std::string& logDir = std::string("")) + { setup(wnd,mgr,logging, logDir); } ~MyGUIManager() { shutdown(); } - void setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool logging=false); + void setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool logging=false, const std::string& logDir = std::string("")); void shutdown(); MyGUI::Gui *getGui() { return mGui; } diff --git a/ogre/renderer.cpp b/ogre/renderer.cpp index c60a29c77b..1773832d79 100644 --- a/ogre/renderer.cpp +++ b/ogre/renderer.cpp @@ -28,12 +28,20 @@ void OgreRenderer::screenshot(const std::string &file) } bool OgreRenderer::configure(bool showConfig, + const std::string &cfgPath, + const std::string &logPath, const std::string &pluginCfg, bool _logging) { + std::string theLogFile("Ogre.log"); + std::string theCfgFile("ogre.cfg"); + + theLogFile.insert(0, logPath); + theCfgFile.insert(0, cfgPath); + // Set up logging first new LogManager; - Log *log = LogManager::getSingleton().createLog("Ogre.log"); + Log *log = LogManager::getSingleton().createLog(theLogFile); logging = _logging; if(logging) @@ -43,7 +51,7 @@ bool OgreRenderer::configure(bool showConfig, // Disable logging log->setDebugOutputEnabled(false); - mRoot = new Root(pluginCfg, "ogre.cfg", ""); + mRoot = new Root(pluginCfg, theCfgFile, ""); // Show the configuration dialog and initialise the system, if the // showConfig parameter is specified. The settings are stored in @@ -58,6 +66,21 @@ bool OgreRenderer::configure(bool showConfig, return !result; } +bool OgreRenderer::configure(bool showConfig, + const std::string &cfgPath, + const std::string &pluginCfg, + bool _logging) +{ + return configure(showConfig, cfgPath, cfgPath, pluginCfg, _logging); +} + +bool OgreRenderer::configure(bool showConfig, + const std::string &pluginCfg, + bool _logging) +{ + return configure(showConfig, "", pluginCfg, _logging); +} + void OgreRenderer::createWindow(const std::string &title) { assert(mRoot); diff --git a/ogre/renderer.hpp b/ogre/renderer.hpp index f706b16f7e..59b69f6896 100644 --- a/ogre/renderer.hpp +++ b/ogre/renderer.hpp @@ -33,6 +33,19 @@ namespace Render : mRoot(NULL), mWindow(NULL), mScene(NULL) {} ~OgreRenderer() { cleanup(); } + /** Configure the renderer. This will load configuration files and + set up the Root and logging classes. */ + bool configure(bool showConfig, // Show config dialog box? + const std::string &cfgPath, // Path to directory where to store config files + const std::string &logPath, // Path to directory where to store log files + const std::string &pluginCfg, // plugin.cfg file + bool _logging); // Enable or disable logging + + bool configure(bool showConfig, // Show config dialog box? + const std::string &cfgPath, // Path to directory where to store config files + const std::string &pluginCfg, // plugin.cfg file + bool _logging); // Enable or disable logging + /** Configure the renderer. This will load configuration files and set up the Root and logging classes. */ bool configure(bool showConfig, // Show config dialog box?