1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 21:42:13 +00:00
OpenMW/components/myguiplatform/myguiplatform.hpp

80 lines
2.1 KiB
C++
Raw Normal View History

2015-04-30 23:15:25 +00:00
#ifndef OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIPLATFORM_H
#define OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIPLATFORM_H
2015-04-24 19:55:30 +00:00
#include "MyGUI_Prerequest.h"
#include "MyGUI_LogManager.h"
#include "myguirendermanager.hpp"
#include "myguidatamanager.hpp"
#include "myguiloglistener.hpp"
2015-04-24 19:55:30 +00:00
2015-04-30 23:15:25 +00:00
namespace osgMyGUI
2015-04-24 19:55:30 +00:00
{
class Platform
{
public:
2015-05-14 22:41:21 +00:00
Platform(osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::TextureManager* textureManager, float uiScalingFactor)
: mRenderManager(nullptr)
, mDataManager(nullptr)
, mLogManager(nullptr)
, mLogFacility(nullptr)
2015-04-24 19:55:30 +00:00
{
mLogManager = new MyGUI::LogManager();
2015-05-14 22:41:21 +00:00
mRenderManager = new RenderManager(viewer, guiRoot, textureManager, uiScalingFactor);
2015-04-24 19:55:30 +00:00
mDataManager = new DataManager();
}
~Platform()
{
delete mRenderManager;
mRenderManager = nullptr;
delete mDataManager;
mDataManager = nullptr;
delete mLogManager;
mLogManager = nullptr;
delete mLogFacility;
mLogFacility = nullptr;
2015-04-24 19:55:30 +00:00
}
2015-04-28 14:02:29 +00:00
void initialise(const std::string& resourcePath, const std::string& _logName = "MyGUI.log")
2015-04-24 19:55:30 +00:00
{
if (!_logName.empty() && !mLogFacility)
{
mLogFacility = new LogFacility(_logName, false);
mLogManager->addLogSource(mLogFacility->getSource());
}
2015-04-24 19:55:30 +00:00
mDataManager->setResourcePath(resourcePath);
mRenderManager->initialise();
mDataManager->initialise();
}
void shutdown()
{
mRenderManager->shutdown();
2015-04-24 19:55:30 +00:00
mDataManager->shutdown();
}
RenderManager* getRenderManagerPtr()
{
return mRenderManager;
}
DataManager* getDataManagerPtr()
{
return mDataManager;
}
private:
RenderManager* mRenderManager;
DataManager* mDataManager;
MyGUI::LogManager* mLogManager;
LogFacility* mLogFacility;
2015-04-24 19:55:30 +00:00
};
}
#endif