mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 12:53:51 +00:00
Make configuration and log paths configurable
This commit is contained in:
parent
3a17aaa697
commit
7185eab18c
4 changed files with 48 additions and 8 deletions
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
using namespace OEngine::GUI;
|
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(wnd);
|
||||||
assert(mgr);
|
assert(mgr);
|
||||||
|
@ -21,13 +21,17 @@ void MyGUIManager::setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool
|
||||||
LogManager::initialise();
|
LogManager::initialise();
|
||||||
LogManager::setSTDOutputEnabled(logging);
|
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.
|
// Set up OGRE platform. We might make this more generic later.
|
||||||
mPlatform = new OgrePlatform();
|
mPlatform = new OgrePlatform();
|
||||||
mPlatform->initialise(wnd, mgr);
|
mPlatform->initialise(wnd, mgr, "General", theLogFile);
|
||||||
|
|
||||||
// Create GUI
|
// Create GUI
|
||||||
mGui = new Gui();
|
mGui = new Gui();
|
||||||
mGui->initialise();
|
mGui->initialise("core.xml", theLogFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyGUIManager::shutdown()
|
void MyGUIManager::shutdown()
|
||||||
|
|
|
@ -23,11 +23,11 @@ namespace GUI
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MyGUIManager() : mPlatform(NULL), mGui(NULL) {}
|
MyGUIManager() : mPlatform(NULL), mGui(NULL) {}
|
||||||
MyGUIManager(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool logging=false)
|
MyGUIManager(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool logging=false, const std::string& logDir = std::string(""))
|
||||||
{ setup(wnd,mgr,logging); }
|
{ setup(wnd,mgr,logging, logDir); }
|
||||||
~MyGUIManager() { shutdown(); }
|
~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();
|
void shutdown();
|
||||||
|
|
||||||
MyGUI::Gui *getGui() { return mGui; }
|
MyGUI::Gui *getGui() { return mGui; }
|
||||||
|
|
|
@ -28,12 +28,20 @@ void OgreRenderer::screenshot(const std::string &file)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OgreRenderer::configure(bool showConfig,
|
bool OgreRenderer::configure(bool showConfig,
|
||||||
|
const std::string &cfgPath,
|
||||||
|
const std::string &logPath,
|
||||||
const std::string &pluginCfg,
|
const std::string &pluginCfg,
|
||||||
bool _logging)
|
bool _logging)
|
||||||
{
|
{
|
||||||
|
std::string theLogFile("Ogre.log");
|
||||||
|
std::string theCfgFile("ogre.cfg");
|
||||||
|
|
||||||
|
theLogFile.insert(0, logPath);
|
||||||
|
theCfgFile.insert(0, cfgPath);
|
||||||
|
|
||||||
// Set up logging first
|
// Set up logging first
|
||||||
new LogManager;
|
new LogManager;
|
||||||
Log *log = LogManager::getSingleton().createLog("Ogre.log");
|
Log *log = LogManager::getSingleton().createLog(theLogFile);
|
||||||
logging = _logging;
|
logging = _logging;
|
||||||
|
|
||||||
if(logging)
|
if(logging)
|
||||||
|
@ -43,7 +51,7 @@ bool OgreRenderer::configure(bool showConfig,
|
||||||
// Disable logging
|
// Disable logging
|
||||||
log->setDebugOutputEnabled(false);
|
log->setDebugOutputEnabled(false);
|
||||||
|
|
||||||
mRoot = new Root(pluginCfg, "ogre.cfg", "");
|
mRoot = new Root(pluginCfg, theCfgFile, "");
|
||||||
|
|
||||||
// Show the configuration dialog and initialise the system, if the
|
// Show the configuration dialog and initialise the system, if the
|
||||||
// showConfig parameter is specified. The settings are stored in
|
// showConfig parameter is specified. The settings are stored in
|
||||||
|
@ -58,6 +66,21 @@ bool OgreRenderer::configure(bool showConfig,
|
||||||
return !result;
|
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)
|
void OgreRenderer::createWindow(const std::string &title)
|
||||||
{
|
{
|
||||||
assert(mRoot);
|
assert(mRoot);
|
||||||
|
|
|
@ -33,6 +33,19 @@ namespace Render
|
||||||
: mRoot(NULL), mWindow(NULL), mScene(NULL) {}
|
: mRoot(NULL), mWindow(NULL), mScene(NULL) {}
|
||||||
~OgreRenderer() { cleanup(); }
|
~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
|
/** Configure the renderer. This will load configuration files and
|
||||||
set up the Root and logging classes. */
|
set up the Root and logging classes. */
|
||||||
bool configure(bool showConfig, // Show config dialog box?
|
bool configure(bool showConfig, // Show config dialog box?
|
||||||
|
|
Loading…
Reference in a new issue