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