mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-31 11:45:32 +00:00
b920e1bde7
- Microsoft Visual Studio Community 2015 Version 14.0.23107.0 D14REL - Qt 5.5, commit 1d3966833b5f27fb262f2d3727557ef2c8947828 - SDL2 default branch, Changeset: 9834 (d3fa6d0d3793) - Ogre default branch, Changeset: 8048 (19479be2c7c5) - Boost 1.59, commit 9a02cf8eb34eb31f0858c223ce95319f103addfa - OpenAL commit 8fa4f276f89985be44007ce166109837cbfd5763 (*) only tested compilation and startup of the each app
53 lines
1.5 KiB
C++
53 lines
1.5 KiB
C++
#include "overlaymask.hpp"
|
|
|
|
#include <OgreOverlay.h>
|
|
#include <OgreOverlayManager.h>
|
|
#include <OgreOverlayContainer.h>
|
|
|
|
#include "textoverlay.hpp"
|
|
#include "../../model/world/cellcoordinates.hpp"
|
|
|
|
namespace CSVRender
|
|
{
|
|
|
|
// ideas from http://www.ogre3d.org/forums/viewtopic.php?f=5&t=44828#p486334
|
|
OverlayMask::OverlayMask(std::map<CSMWorld::CellCoordinates, TextOverlay *> &overlays, Ogre::Viewport* viewport)
|
|
: mTextOverlays(overlays), mViewport(viewport)
|
|
{
|
|
}
|
|
|
|
OverlayMask::~OverlayMask()
|
|
{
|
|
}
|
|
|
|
void OverlayMask::setViewport(Ogre::Viewport *viewport)
|
|
{
|
|
mViewport = viewport;
|
|
}
|
|
|
|
void OverlayMask::preViewportUpdate(const Ogre::RenderTargetViewportEvent &event)
|
|
{
|
|
if(event.source == mViewport)
|
|
{
|
|
Ogre::OverlayManager &overlayMgr = Ogre::OverlayManager::getSingleton();
|
|
for(Ogre::OverlayManager::OverlayMapIterator iter = overlayMgr.getOverlayIterator();
|
|
iter.hasMoreElements();)
|
|
{
|
|
Ogre::Overlay* item = iter.getNext();
|
|
for(Ogre::Overlay::Overlay2DElementsIterator it = item->get2DElementsIterator();
|
|
it.hasMoreElements();)
|
|
{
|
|
Ogre::OverlayContainer* container = it.getNext();
|
|
if(container) container->hide();
|
|
}
|
|
}
|
|
|
|
std::map<CSMWorld::CellCoordinates, TextOverlay *>::iterator it = mTextOverlays.begin();
|
|
for(; it != mTextOverlays.end(); ++it)
|
|
{
|
|
it->second->show(true);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|