Make configuration and log paths configurable

This commit is contained in:
Jan-Peter Nilsson 2011-01-04 01:03:05 +01:00
parent 3a17aaa697
commit 7185eab18c
4 changed files with 48 additions and 8 deletions

View file

@ -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()

View file

@ -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; }