mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Convert OverlaySystem to a OpenCS style singleton.
This commit is contained in:
parent
aff6f6fdb2
commit
094f046087
@ -82,7 +82,7 @@ opencs_units (view/render
|
|||||||
|
|
||||||
opencs_units_noqt (view/render
|
opencs_units_noqt (view/render
|
||||||
navigation navigation1st navigationfree navigationorbit lighting lightingday lightingnight
|
navigation navigation1st navigationfree navigationorbit lighting lightingday lightingnight
|
||||||
lightingbright object cell terrainstorage textoverlay overlaymask
|
lightingbright object cell terrainstorage textoverlay overlaymask overlaysystem
|
||||||
)
|
)
|
||||||
|
|
||||||
opencs_hdrs_noqt (view/render
|
opencs_hdrs_noqt (view/render
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
#include "model/doc/document.hpp"
|
#include "model/doc/document.hpp"
|
||||||
#include "model/world/data.hpp"
|
#include "model/world/data.hpp"
|
||||||
#include "view/render/overlaysystem.hpp"
|
|
||||||
|
|
||||||
CS::Editor::Editor (OgreInit::OgreInit& ogreInit)
|
CS::Editor::Editor (OgreInit::OgreInit& ogreInit)
|
||||||
: mUserSettings (mCfgMgr), mDocumentManager (mCfgMgr), mViewManager (mDocumentManager),
|
: mUserSettings (mCfgMgr), mDocumentManager (mCfgMgr), mViewManager (mDocumentManager),
|
||||||
@ -276,7 +275,7 @@ std::auto_ptr<sh::Factory> CS::Editor::setupGraphics()
|
|||||||
Ogre::Root::getSingleton().setRenderSystem(Ogre::Root::getSingleton().getRenderSystemByName(renderSystem));
|
Ogre::Root::getSingleton().setRenderSystem(Ogre::Root::getSingleton().getRenderSystemByName(renderSystem));
|
||||||
|
|
||||||
// Initialise Ogre::OverlaySystem after Ogre::Root but before initialisation
|
// Initialise Ogre::OverlaySystem after Ogre::Root but before initialisation
|
||||||
CSVRender::OverlaySystem::instance();
|
mOverlaySystem.get();
|
||||||
|
|
||||||
Ogre::Root::getSingleton().initialise(false);
|
Ogre::Root::getSingleton().initialise(false);
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "view/doc/newgame.hpp"
|
#include "view/doc/newgame.hpp"
|
||||||
|
|
||||||
#include "view/settings/dialog.hpp"
|
#include "view/settings/dialog.hpp"
|
||||||
|
#include "view/render/overlaysystem.hpp"
|
||||||
|
|
||||||
namespace OgreInit
|
namespace OgreInit
|
||||||
{
|
{
|
||||||
@ -42,6 +43,7 @@ namespace CS
|
|||||||
Nif::Cache mNifCache;
|
Nif::Cache mNifCache;
|
||||||
Files::ConfigurationManager mCfgMgr;
|
Files::ConfigurationManager mCfgMgr;
|
||||||
CSMSettings::UserSettings mUserSettings;
|
CSMSettings::UserSettings mUserSettings;
|
||||||
|
CSVRender::OverlaySystem mOverlaySystem;
|
||||||
CSMDoc::DocumentManager mDocumentManager;
|
CSMDoc::DocumentManager mDocumentManager;
|
||||||
CSVDoc::ViewManager mViewManager;
|
CSVDoc::ViewManager mViewManager;
|
||||||
CSVDoc::StartupDialogue mStartup;
|
CSVDoc::StartupDialogue mStartup;
|
||||||
|
40
apps/opencs/view/render/overlaysystem.cpp
Normal file
40
apps/opencs/view/render/overlaysystem.cpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#include "overlaysystem.hpp"
|
||||||
|
|
||||||
|
#include <OgreOverlaySystem.h>
|
||||||
|
|
||||||
|
namespace CSVRender
|
||||||
|
{
|
||||||
|
OverlaySystem *OverlaySystem::mOverlaySystemInstance = 0;
|
||||||
|
|
||||||
|
OverlaySystem::OverlaySystem() : mOverlaySystem(NULL)
|
||||||
|
{
|
||||||
|
assert(!mOverlaySystemInstance);
|
||||||
|
mOverlaySystemInstance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
OverlaySystem::~OverlaySystem()
|
||||||
|
{
|
||||||
|
if(mOverlaySystem)
|
||||||
|
delete mOverlaySystem;
|
||||||
|
}
|
||||||
|
|
||||||
|
OverlaySystem &OverlaySystem::instance()
|
||||||
|
{
|
||||||
|
assert(mOverlaySystemInstance);
|
||||||
|
return *mOverlaySystemInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ogre::OverlaySystem *OverlaySystem::get()
|
||||||
|
{
|
||||||
|
if(!mOverlaySystem)
|
||||||
|
mOverlaySystem = new Ogre::OverlaySystem();
|
||||||
|
return mOverlaySystem;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OverlaySystem::destroy()
|
||||||
|
{
|
||||||
|
delete mOverlaySystem;
|
||||||
|
mOverlaySystem = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,40 +1,26 @@
|
|||||||
#ifndef OPENCS_VIEW_OVERLAYSYSTEM_H
|
#ifndef OPENCS_VIEW_OVERLAYSYSTEM_H
|
||||||
#define OPENCS_VIEW_OVERLAYSYSTEM_H
|
#define OPENCS_VIEW_OVERLAYSYSTEM_H
|
||||||
|
|
||||||
#include <OgreOverlaySystem.h>
|
namespace Ogre
|
||||||
|
{
|
||||||
|
class OverlaySystem;
|
||||||
|
}
|
||||||
|
|
||||||
namespace CSVRender
|
namespace CSVRender
|
||||||
{
|
{
|
||||||
class OverlaySystem
|
class OverlaySystem
|
||||||
{
|
{
|
||||||
Ogre::OverlaySystem *mOverlaySystem;
|
Ogre::OverlaySystem *mOverlaySystem;
|
||||||
|
static OverlaySystem *mOverlaySystemInstance;
|
||||||
OverlaySystem() {
|
|
||||||
mOverlaySystem = new Ogre::OverlaySystem();
|
|
||||||
}
|
|
||||||
|
|
||||||
~OverlaySystem() {
|
|
||||||
if(mOverlaySystem) delete mOverlaySystem;
|
|
||||||
}
|
|
||||||
|
|
||||||
OverlaySystem(OverlaySystem const&);
|
|
||||||
void operator=(OverlaySystem const&);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static OverlaySystem &instance() {
|
OverlaySystem();
|
||||||
static OverlaySystem mInstance;
|
~OverlaySystem();
|
||||||
return mInstance;
|
static OverlaySystem &instance();
|
||||||
}
|
|
||||||
|
|
||||||
Ogre::OverlaySystem *get() {
|
Ogre::OverlaySystem *get();
|
||||||
return mOverlaySystem;
|
void destroy();
|
||||||
}
|
|
||||||
|
|
||||||
void destroy() {
|
|
||||||
delete mOverlaySystem;
|
|
||||||
mOverlaySystem = NULL;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <OgreCamera.h>
|
#include <OgreCamera.h>
|
||||||
#include <OgreSceneNode.h>
|
#include <OgreSceneNode.h>
|
||||||
#include <OgreViewport.h>
|
#include <OgreViewport.h>
|
||||||
|
#include <OgreOverlaySystem.h>
|
||||||
|
|
||||||
#include "../widget/scenetoolmode.hpp"
|
#include "../widget/scenetoolmode.hpp"
|
||||||
#include "../../model/settings/usersettings.hpp"
|
#include "../../model/settings/usersettings.hpp"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user