forked from mirror/openmw-tes3mp
Singleton wrapper for Ogre OverlaySystem.
This commit is contained in:
parent
57b337d368
commit
994420aa57
3 changed files with 39 additions and 6 deletions
36
apps/opencs/view/render/overlaysystem.hpp
Normal file
36
apps/opencs/view/render/overlaysystem.hpp
Normal file
|
@ -0,0 +1,36 @@
|
|||
#ifndef OPENCS_VIEW_OVERLAYSYSTEM_H
|
||||
#define OPENCS_VIEW_OVERLAYSYSTEM_H
|
||||
|
||||
#include <OgreOverlaySystem.h>
|
||||
|
||||
namespace CSVRender
|
||||
{
|
||||
class OverlaySystem
|
||||
{
|
||||
Ogre::OverlaySystem *mOverlaySystem;
|
||||
|
||||
OverlaySystem() {
|
||||
mOverlaySystem = new Ogre::OverlaySystem();
|
||||
}
|
||||
|
||||
~OverlaySystem() {
|
||||
delete mOverlaySystem;
|
||||
}
|
||||
|
||||
OverlaySystem(OverlaySystem const&);
|
||||
void operator=(OverlaySystem const&);
|
||||
|
||||
public:
|
||||
|
||||
static OverlaySystem &instance() {
|
||||
static OverlaySystem mInstance;
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
Ogre::OverlaySystem *get() {
|
||||
return mOverlaySystem;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif // OPENCS_VIEW_OVERLAYSYSTEM_H
|
|
@ -11,18 +11,16 @@
|
|||
#include <OgreCamera.h>
|
||||
#include <OgreSceneNode.h>
|
||||
#include <OgreViewport.h>
|
||||
#include <OgreOverlaySystem.h>
|
||||
|
||||
#include "../widget/scenetoolmode.hpp"
|
||||
#include "../../model/settings/usersettings.hpp"
|
||||
|
||||
#include "navigation.hpp"
|
||||
#include "lighting.hpp"
|
||||
#include "overlaysystem.hpp"
|
||||
|
||||
namespace CSVRender
|
||||
{
|
||||
Ogre::OverlaySystem *SceneWidget::mOverlaySystem = NULL;
|
||||
|
||||
SceneWidget::SceneWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, mCamera(NULL)
|
||||
|
@ -62,8 +60,7 @@ namespace CSVRender
|
|||
|
||||
setLighting (&mLightingDay);
|
||||
|
||||
if(!mOverlaySystem)
|
||||
mOverlaySystem = new Ogre::OverlaySystem();
|
||||
mOverlaySystem = OverlaySystem::instance().get();
|
||||
mSceneMgr->addRenderQueueListener(mOverlaySystem);
|
||||
|
||||
QTimer *timer = new QTimer (this);
|
||||
|
|
|
@ -97,7 +97,7 @@ namespace CSVRender
|
|||
Ogre::SceneManager* mSceneMgr;
|
||||
Ogre::RenderWindow* mWindow;
|
||||
Ogre::Viewport *mViewport;
|
||||
static Ogre::OverlaySystem *mOverlaySystem;
|
||||
Ogre::OverlaySystem *mOverlaySystem;
|
||||
|
||||
Navigation *mNavigation;
|
||||
Lighting *mLighting;
|
||||
|
|
Loading…
Reference in a new issue