Remove redundant Platform::initialize function

check_span
elsid 2 years ago
parent c0e1642d7f
commit a281bcaf90
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

@ -194,8 +194,9 @@ namespace MWGui
, mWindowVisible(true)
{
mScalingFactor = std::clamp(Settings::Manager::getFloat("scaling factor", "GUI"), 0.5f, 8.f);
mGuiPlatform = new osgMyGUI::Platform(viewer, guiRoot, resourceSystem->getImageManager(), resourceSystem->getVFS(), mScalingFactor);
mGuiPlatform->initialise("mygui", (std::filesystem::path(logpath) / "MyGUI.log").generic_string());
mGuiPlatform = new osgMyGUI::Platform(viewer, guiRoot, resourceSystem->getImageManager(),
resourceSystem->getVFS(), mScalingFactor, "mygui",
(std::filesystem::path(logpath) / "MyGUI.log").generic_string());
mGui = new MyGUI::Gui;
mGui->initialise("");

@ -8,23 +8,14 @@ namespace osgMyGUI
{
Platform::Platform(osgViewer::Viewer *viewer, osg::Group* guiRoot, Resource::ImageManager* imageManager,
const VFS::Manager* vfs, float uiScalingFactor)
: mLogFacility(nullptr)
const VFS::Manager* vfs, float uiScalingFactor, const std::string& resourcePath, const std::string& logName)
: mLogFacility(logName.empty() ? nullptr : std::make_unique<LogFacility>(logName, false))
, mLogManager(std::make_unique<MyGUI::LogManager>())
, mDataManager(std::make_unique<DataManager>(vfs))
, mRenderManager(std::make_unique<RenderManager>(viewer, guiRoot, imageManager, uiScalingFactor))
{
}
Platform::~Platform() {}
void Platform::initialise(const std::string &resourcePath, const std::string &_logName)
{
if (!_logName.empty() && !mLogFacility)
{
mLogFacility = std::make_unique<LogFacility>(_logName, false);
if (mLogFacility != nullptr)
mLogManager->addLogSource(mLogFacility->getSource());
}
mDataManager->setResourcePath(resourcePath);
@ -32,6 +23,8 @@ void Platform::initialise(const std::string &resourcePath, const std::string &_l
mDataManager->initialise();
}
Platform::~Platform() = default;
void Platform::shutdown()
{
mRenderManager->shutdown();

@ -33,12 +33,12 @@ namespace osgMyGUI
class Platform
{
public:
Platform(osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::ImageManager* imageManager, const VFS::Manager* vfs, float uiScalingFactor);
Platform(osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::ImageManager* imageManager,
const VFS::Manager* vfs, float uiScalingFactor, const std::string& resourcePath,
const std::string& logName = "MyGUI.log");
~Platform();
void initialise(const std::string& resourcePath, const std::string& _logName = "MyGUI.log");
void shutdown();
RenderManager* getRenderManagerPtr();

Loading…
Cancel
Save