1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-31 06:36:39 +00:00

Remove redundant Platform::initialize function

This commit is contained in:
elsid 2022-07-18 20:44:57 +02:00
parent c0e1642d7f
commit a281bcaf90
No known key found for this signature in database
GPG key ID: 4DE04C198CBA7625
3 changed files with 12 additions and 18 deletions

View file

@ -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("");

View file

@ -7,24 +7,15 @@
namespace osgMyGUI
{
Platform::Platform(osgViewer::Viewer *viewer, osg::Group *guiRoot, Resource::ImageManager *imageManager,
const VFS::Manager* vfs, float uiScalingFactor)
: mLogFacility(nullptr)
Platform::Platform(osgViewer::Viewer *viewer, osg::Group* guiRoot, Resource::ImageManager* imageManager,
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();

View file

@ -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();