mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 08:15:37 +00:00
osgMyGUI: move Platform methods to the .cpp file
This commit is contained in:
parent
7ff168b787
commit
51f3a8fec6
4 changed files with 91 additions and 53 deletions
|
@ -33,6 +33,7 @@
|
|||
#include <components/translation/translation.hpp>
|
||||
|
||||
#include <components/myguiplatform/myguiplatform.hpp>
|
||||
#include <components/myguiplatform/myguirendermanager.hpp>
|
||||
|
||||
#include <components/vfs/manager.hpp>
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ add_component_dir (loadinglistener
|
|||
)
|
||||
|
||||
add_component_dir (myguiplatform
|
||||
myguirendermanager myguidatamanager myguiplatform myguitexture myguiloglistener
|
||||
myguirendermanager myguidatamanager myguiplatform myguitexture myguiloglistener additivelayer
|
||||
)
|
||||
|
||||
add_component_dir (widgets
|
||||
|
|
|
@ -1,2 +1,64 @@
|
|||
#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
|
||||
#define OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIPLATFORM_H
|
||||
|
||||
#include "MyGUI_Prerequest.h"
|
||||
#include "MyGUI_LogManager.h"
|
||||
#include <string>
|
||||
|
||||
#include "myguirendermanager.hpp"
|
||||
#include "myguidatamanager.hpp"
|
||||
#include "myguiloglistener.hpp"
|
||||
namespace osgViewer
|
||||
{
|
||||
class Viewer;
|
||||
}
|
||||
namespace osg
|
||||
{
|
||||
class Group;
|
||||
}
|
||||
namespace Resource
|
||||
{
|
||||
class TextureManager;
|
||||
}
|
||||
namespace MyGUI
|
||||
{
|
||||
class LogManager;
|
||||
}
|
||||
|
||||
namespace osgMyGUI
|
||||
{
|
||||
|
||||
class RenderManager;
|
||||
class DataManager;
|
||||
class LogFacility;
|
||||
|
||||
class Platform
|
||||
{
|
||||
public:
|
||||
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(osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::TextureManager* textureManager, float uiScalingFactor);
|
||||
|
||||
~Platform()
|
||||
{
|
||||
delete mRenderManager;
|
||||
mRenderManager = nullptr;
|
||||
delete mDataManager;
|
||||
mDataManager = nullptr;
|
||||
delete mLogManager;
|
||||
mLogManager = nullptr;
|
||||
delete mLogFacility;
|
||||
mLogFacility = nullptr;
|
||||
}
|
||||
~Platform();
|
||||
|
||||
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());
|
||||
}
|
||||
void initialise(const std::string& resourcePath, const std::string& _logName = "MyGUI.log");
|
||||
|
||||
mDataManager->setResourcePath(resourcePath);
|
||||
void shutdown();
|
||||
|
||||
mRenderManager->initialise();
|
||||
mDataManager->initialise();
|
||||
}
|
||||
RenderManager* getRenderManagerPtr();
|
||||
|
||||
void shutdown()
|
||||
{
|
||||
mRenderManager->shutdown();
|
||||
mDataManager->shutdown();
|
||||
}
|
||||
|
||||
RenderManager* getRenderManagerPtr()
|
||||
{
|
||||
return mRenderManager;
|
||||
}
|
||||
|
||||
DataManager* getDataManagerPtr()
|
||||
{
|
||||
return mDataManager;
|
||||
}
|
||||
DataManager* getDataManagerPtr();
|
||||
|
||||
private:
|
||||
RenderManager* mRenderManager;
|
||||
|
|
Loading…
Reference in a new issue