mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-19 12:11:32 +00:00
Use unique_ptr for osgMyGUI::Platform members
This commit is contained in:
parent
ebc34ea251
commit
c0e1642d7f
2 changed files with 15 additions and 30 deletions
|
@ -7,34 +7,22 @@
|
||||||
namespace osgMyGUI
|
namespace osgMyGUI
|
||||||
{
|
{
|
||||||
|
|
||||||
Platform::Platform(osgViewer::Viewer *viewer, osg::Group *guiRoot, Resource::ImageManager *imageManager, const VFS::Manager* vfs, float uiScalingFactor)
|
Platform::Platform(osgViewer::Viewer *viewer, osg::Group *guiRoot, Resource::ImageManager *imageManager,
|
||||||
: mRenderManager(nullptr)
|
const VFS::Manager* vfs, float uiScalingFactor)
|
||||||
, mDataManager(nullptr)
|
: mLogFacility(nullptr)
|
||||||
, mLogManager(nullptr)
|
, mLogManager(std::make_unique<MyGUI::LogManager>())
|
||||||
, mLogFacility(nullptr)
|
, mDataManager(std::make_unique<DataManager>(vfs))
|
||||||
|
, mRenderManager(std::make_unique<RenderManager>(viewer, guiRoot, imageManager, uiScalingFactor))
|
||||||
{
|
{
|
||||||
mLogManager = new MyGUI::LogManager();
|
|
||||||
mRenderManager = new RenderManager(viewer, guiRoot, imageManager, uiScalingFactor);
|
|
||||||
mDataManager = new DataManager(vfs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform::~Platform()
|
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)
|
void Platform::initialise(const std::string &resourcePath, const std::string &_logName)
|
||||||
{
|
{
|
||||||
if (!_logName.empty() && !mLogFacility)
|
if (!_logName.empty() && !mLogFacility)
|
||||||
{
|
{
|
||||||
mLogFacility = new LogFacility(_logName, false);
|
mLogFacility = std::make_unique<LogFacility>(_logName, false);
|
||||||
mLogManager->addLogSource(mLogFacility->getSource());
|
mLogManager->addLogSource(mLogFacility->getSource());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,13 +40,12 @@ void Platform::shutdown()
|
||||||
|
|
||||||
RenderManager *Platform::getRenderManagerPtr()
|
RenderManager *Platform::getRenderManagerPtr()
|
||||||
{
|
{
|
||||||
return mRenderManager;
|
return mRenderManager.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
DataManager *Platform::getDataManagerPtr()
|
DataManager *Platform::getDataManagerPtr()
|
||||||
{
|
{
|
||||||
return mDataManager;
|
return mDataManager.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIPLATFORM_H
|
#define OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIPLATFORM_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <components/vfs/manager.hpp>
|
#include <components/vfs/manager.hpp>
|
||||||
|
|
||||||
|
@ -45,13 +46,10 @@ namespace osgMyGUI
|
||||||
DataManager* getDataManagerPtr();
|
DataManager* getDataManagerPtr();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RenderManager* mRenderManager;
|
std::unique_ptr<LogFacility> mLogFacility;
|
||||||
DataManager* mDataManager;
|
std::unique_ptr<MyGUI::LogManager> mLogManager;
|
||||||
MyGUI::LogManager* mLogManager;
|
std::unique_ptr<DataManager> mDataManager;
|
||||||
LogFacility* mLogFacility;
|
std::unique_ptr<RenderManager> mRenderManager;
|
||||||
|
|
||||||
void operator=(const Platform&);
|
|
||||||
Platform(const Platform&);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue