osgMyGUI: move Platform methods to the .cpp file

openmw-37
scrawl 9 years ago
parent 7ff168b787
commit 51f3a8fec6

@ -33,6 +33,7 @@
#include <components/translation/translation.hpp> #include <components/translation/translation.hpp>
#include <components/myguiplatform/myguiplatform.hpp> #include <components/myguiplatform/myguiplatform.hpp>
#include <components/myguiplatform/myguirendermanager.hpp>
#include <components/vfs/manager.hpp> #include <components/vfs/manager.hpp>

@ -115,7 +115,7 @@ add_component_dir (loadinglistener
) )
add_component_dir (myguiplatform add_component_dir (myguiplatform
myguirendermanager myguidatamanager myguiplatform myguitexture myguiloglistener myguirendermanager myguidatamanager myguiplatform myguitexture myguiloglistener additivelayer
) )
add_component_dir (widgets add_component_dir (widgets

@ -1,2 +1,64 @@
#include "myguiplatform.hpp" #include "myguiplatform.hpp"
#include "myguirendermanager.hpp"
#include "myguidatamanager.hpp"
#include "myguiloglistener.hpp"
namespace osgMyGUI
{
Platform::Platform(osgViewer::Viewer *viewer, osg::Group *guiRoot, Resource::TextureManager *textureManager, float uiScalingFactor)
: mRenderManager(nullptr)
, mDataManager(nullptr)
, mLogManager(nullptr)
, mLogFacility(nullptr)
{
mLogManager = new MyGUI::LogManager();
mRenderManager = new RenderManager(viewer, guiRoot, textureManager, uiScalingFactor);
mDataManager = new DataManager();
}
Platform::~Platform()
{
delete mRenderManager;
mRenderManager = nullptr;
delete mDataManager;
mDataManager = nullptr;
delete mLogManager;
mLogManager = nullptr;
delete mLogFacility;
mLogFacility = nullptr;
}
void Platform::initialise(const std::string &resourcePath, const std::string &_logName)
{
if (!_logName.empty() && !mLogFacility)
{
mLogFacility = new LogFacility(_logName, false);
mLogManager->addLogSource(mLogFacility->getSource());
}
mDataManager->setResourcePath(resourcePath);
mRenderManager->initialise();
mDataManager->initialise();
}
void Platform::shutdown()
{
mRenderManager->shutdown();
mDataManager->shutdown();
}
RenderManager *Platform::getRenderManagerPtr()
{
return mRenderManager;
}
DataManager *Platform::getDataManagerPtr()
{
return mDataManager;
}
}

@ -1,71 +1,46 @@
#ifndef OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIPLATFORM_H #ifndef OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIPLATFORM_H
#define OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIPLATFORM_H #define OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIPLATFORM_H
#include "MyGUI_Prerequest.h" #include <string>
#include "MyGUI_LogManager.h"
#include "myguirendermanager.hpp" namespace osgViewer
#include "myguidatamanager.hpp" {
#include "myguiloglistener.hpp" class Viewer;
}
namespace osg
{
class Group;
}
namespace Resource
{
class TextureManager;
}
namespace MyGUI
{
class LogManager;
}
namespace osgMyGUI namespace osgMyGUI
{ {
class RenderManager;
class DataManager;
class LogFacility;
class Platform class Platform
{ {
public: public:
Platform(osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::TextureManager* textureManager, float uiScalingFactor) Platform(osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::TextureManager* textureManager, float uiScalingFactor);
: mRenderManager(nullptr)
, mDataManager(nullptr)
, mLogManager(nullptr)
, mLogFacility(nullptr)
{
mLogManager = new MyGUI::LogManager();
mRenderManager = new RenderManager(viewer, guiRoot, textureManager, uiScalingFactor);
mDataManager = new DataManager();
}
~Platform()
{
delete mRenderManager;
mRenderManager = nullptr;
delete mDataManager;
mDataManager = nullptr;
delete mLogManager;
mLogManager = nullptr;
delete mLogFacility;
mLogFacility = nullptr;
}
void initialise(const std::string& resourcePath, const std::string& _logName = "MyGUI.log")
{
if (!_logName.empty() && !mLogFacility)
{
mLogFacility = new LogFacility(_logName, false);
mLogManager->addLogSource(mLogFacility->getSource());
}
mDataManager->setResourcePath(resourcePath); ~Platform();
mRenderManager->initialise(); void initialise(const std::string& resourcePath, const std::string& _logName = "MyGUI.log");
mDataManager->initialise();
}
void shutdown() void shutdown();
{
mRenderManager->shutdown();
mDataManager->shutdown();
}
RenderManager* getRenderManagerPtr() RenderManager* getRenderManagerPtr();
{
return mRenderManager;
}
DataManager* getDataManagerPtr() DataManager* getDataManagerPtr();
{
return mDataManager;
}
private: private:
RenderManager* mRenderManager; RenderManager* mRenderManager;

Loading…
Cancel
Save