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) , mWindowVisible(true)
{ {
mScalingFactor = std::clamp(Settings::Manager::getFloat("scaling factor", "GUI"), 0.5f, 8.f); 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 = new osgMyGUI::Platform(viewer, guiRoot, resourceSystem->getImageManager(),
mGuiPlatform->initialise("mygui", (std::filesystem::path(logpath) / "MyGUI.log").generic_string()); resourceSystem->getVFS(), mScalingFactor, "mygui",
(std::filesystem::path(logpath) / "MyGUI.log").generic_string());
mGui = new MyGUI::Gui; mGui = new MyGUI::Gui;
mGui->initialise(""); mGui->initialise("");

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

@ -33,12 +33,12 @@ namespace osgMyGUI
class Platform class Platform
{ {
public: 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(); ~Platform();
void initialise(const std::string& resourcePath, const std::string& _logName = "MyGUI.log");
void shutdown(); void shutdown();
RenderManager* getRenderManagerPtr(); RenderManager* getRenderManagerPtr();

Loading…
Cancel
Save