OGRE  1.9.0
Ogre::OverlayManager Class Reference

Manages Overlay objects, parsing them from .overlay files and storing a lookup library of them. More...

#include <OgreOverlayManager.h>

Inheritance diagram for Ogre::OverlayManager:

Public Types

typedef map< String, OverlayElement * >::type ElementMap
 
typedef map< String, OverlayElementFactory * >::type FactoryMap
 
typedef map< String, Overlay * >::type OverlayMap
 
typedef MapIterator< OverlayMapOverlayMapIterator
 
typedef MapIterator< ElementMapTemplateIterator
 

Public Member Functions

 OverlayManager ()
 
virtual ~OverlayManager ()
 
void _queueOverlaysForRendering (Camera *cam, RenderQueue *pQueue, Viewport *vp)
 Internal method for queueing the visible overlays for rendering.
 
void addOverlayElementFactory (OverlayElementFactory *elemFactory)
 Registers a new OverlayElementFactory with this manager.
 
OverlayElementcloneOverlayElementFromTemplate (const String &templateName, const String &instanceName)
 
Overlaycreate (const String &name)
 Create a new Overlay.
 
OverlayElementcreateOverlayElement (const String &typeName, const String &instanceName, bool isTemplate=false)
 Creates a new OverlayElement of the type requested.
 
OverlayElementcreateOverlayElementFromFactory (const String &typeName, const String &instanceName)
 
OverlayElementcreateOverlayElementFromTemplate (const String &templateName, const String &typeName, const String &instanceName, bool isTemplate=false)
 
void destroy (const String &name)
 Destroys an existing overlay by name.
 
void destroy (Overlay *overlay)
 Destroys an existing overlay.
 
void destroyAll (void)
 Destroys all existing overlays.
 
void destroyAllOverlayElements (bool isTemplate=false)
 Destroys all the OverlayElement created so far.
 
void destroyOverlayElement (const String &instanceName, bool isTemplate=false)
 Destroys a OverlayElement.
 
void destroyOverlayElement (OverlayElement *pInstance, bool isTemplate=false)
 Destroys a OverlayElement.
 
OverlaygetByName (const String &name)
 Retrieve an Overlay by name.
 
Real getLoadingOrder (void) const
 Gets the relative loading order of scripts of this type.
 
OverlayElementgetOverlayElement (const String &name, bool isTemplate=false)
 Gets a reference to an existing element.
 
const FactoryMapgetOverlayElementFactoryMap () const
 Get const access to the list of registered OverlayElement factories.
 
OverlayMapIterator getOverlayIterator (void)
 
const StringVectorgetScriptPatterns (void) const
 Gets the file patterns which should be used to find scripts for this class.
 
TemplateIterator getTemplateIterator ()
 Returns an iterator over all templates in this manager.
 
Real getViewportAspectRatio (void) const
 
int getViewportHeight (void) const
 Gets the height of the destination viewport in pixels.
 
OrientationMode getViewportOrientationMode (void) const
 Gets the orientation mode of the destination viewport.
 
int getViewportWidth (void) const
 Gets the width of the destination viewport in pixels.
 
bool hasOverlayElement (const String &name, bool isTemplate=false)
 Tests if an element exists.
 
bool hasViewportChanged (void) const
 Method for determining if the viewport has changed dimensions.
 
bool isTemplate (String strName) const
 
void operator delete (void *ptr)
 
void operator delete (void *ptr)
 
void operator delete (void *ptr, const char *, int, const char *)
 
void operator delete (void *ptr, const char *, int, const char *)
 
void operator delete (void *ptr, void *)
 
void operator delete (void *ptr, void *)
 
void operator delete[] (void *ptr)
 
void operator delete[] (void *ptr)
 
void operator delete[] (void *ptr, const char *, int, const char *)
 
void operator delete[] (void *ptr, const char *, int, const char *)
 
void * operator new (size_t sz)
 
void * operator new (size_t sz)
 
void * operator new (size_t sz, const char *file, int line, const char *func)
 operator new, with debug line info
 
void * operator new (size_t sz, const char *file, int line, const char *func)
 operator new, with debug line info
 
void * operator new (size_t sz, void *ptr)
 placement operator new
 
void * operator new (size_t sz, void *ptr)
 placement operator new
 
void * operator new[] (size_t sz)
 
void * operator new[] (size_t sz)
 
void * operator new[] (size_t sz, const char *file, int line, const char *func)
 array operator new, with debug line info
 
void * operator new[] (size_t sz, const char *file, int line, const char *func)
 array operator new, with debug line info
 
void parseScript (DataStreamPtr &stream, const String &groupName)
 Parse a script file.
 

Static Public Member Functions

static OverlayManagergetSingleton (void)
 Override standard Singleton retrieval.
 
static OverlayManagergetSingletonPtr (void)
 Override standard Singleton retrieval.
 

Protected Types

typedef set< String >::type LoadedScripts
 

Protected Member Functions

OverlayElementcreateOverlayElementImpl (const String &typeName, const String &instanceName, ElementMap &elementMap)
 
void destroyAllOverlayElementsImpl (ElementMap &elementMap)
 
void destroyOverlayElementImpl (const String &instanceName, ElementMap &elementMap)
 
void destroyOverlayElementImpl (OverlayElement *pInstance, ElementMap &elementMap)
 
ElementMapgetElementMap (bool isTemplate)
 
OverlayElementgetOverlayElementImpl (const String &name, ElementMap &elementMap)
 
bool hasOverlayElementImpl (const String &name, ElementMap &elementMap)
 
void parseAttrib (const String &line, Overlay *pOverlay)
 
bool parseChildren (DataStreamPtr &chunk, const String &line, Overlay *pOverlay, bool isTemplate, OverlayContainer *parent=NULL)
 
void parseElementAttrib (const String &line, Overlay *pOverlay, OverlayElement *pElement)
 
void parseNewElement (DataStreamPtr &chunk, String &elemType, String &elemName, bool isContainer, Overlay *pOverlay, bool isTemplate, String templateName=String(""), OverlayContainer *container=0)
 
void skipToNextCloseBrace (DataStreamPtr &chunk)
 
void skipToNextOpenBrace (DataStreamPtr &chunk)
 

Protected Attributes

FactoryMap mFactories
 
ElementMap mInstances
 
int mLastViewportHeight
 
OrientationMode mLastViewportOrientationMode
 
int mLastViewportWidth
 
LoadedScripts mLoadedScripts
 
OverlayMap mOverlayMap
 
StringVector mScriptPatterns
 
ElementMap mTemplates
 
bool mViewportDimensionsChanged
 

Static Protected Attributes

static OverlayManagermsSingleton
 

Detailed Description

Manages Overlay objects, parsing them from .overlay files and storing a lookup library of them.

Also manages the creation of OverlayContainers and OverlayElements, used for non-interactive 2D elements such as HUDs.

Definition at line 51 of file OgreOverlayManager.h.

Member Typedef Documentation

◆ ElementMap

◆ FactoryMap

◆ LoadedScripts

Definition at line 80 of file OgreOverlayManager.h.

◆ OverlayMap

Definition at line 54 of file OgreOverlayManager.h.

◆ OverlayMapIterator

◆ TemplateIterator

Constructor & Destructor Documentation

◆ OverlayManager()

Ogre::OverlayManager::OverlayManager ( )

Referenced by getSingleton(), and getSingletonPtr().

◆ ~OverlayManager()

virtual Ogre::OverlayManager::~OverlayManager ( )
virtual

Member Function Documentation

◆ _queueOverlaysForRendering()

void Ogre::OverlayManager::_queueOverlaysForRendering ( Camera * cam,
RenderQueue * pQueue,
Viewport * vp )

Internal method for queueing the visible overlays for rendering.

◆ addOverlayElementFactory()

void Ogre::OverlayManager::addOverlayElementFactory ( OverlayElementFactory * elemFactory)

Registers a new OverlayElementFactory with this manager.

Remarks
Should be used by plugins or other apps wishing to provide a new OverlayElement subclass.

◆ cloneOverlayElementFromTemplate()

OverlayElement * Ogre::OverlayManager::cloneOverlayElementFromTemplate ( const String & templateName,
const String & instanceName )
Remarks
Creates a new OverlayElement object from the specified template name. The new object's name, and all of it's children, will be instanceName/orignalName.

◆ create()

Overlay * Ogre::OverlayManager::create ( const String & name)

Create a new Overlay.

◆ createOverlayElement()

OverlayElement * Ogre::OverlayManager::createOverlayElement ( const String & typeName,
const String & instanceName,
bool isTemplate = false )

Creates a new OverlayElement of the type requested.

Remarks
The type of element to create is passed in as a string because this allows plugins to register new types of component.
Parameters
typeNameThe type of element to create.
instanceNameThe name to give the new instance.

References isTemplate().

◆ createOverlayElementFromFactory()

OverlayElement * Ogre::OverlayManager::createOverlayElementFromFactory ( const String & typeName,
const String & instanceName )

◆ createOverlayElementFromTemplate()

OverlayElement * Ogre::OverlayManager::createOverlayElementFromTemplate ( const String & templateName,
const String & typeName,
const String & instanceName,
bool isTemplate = false )

References isTemplate().

◆ createOverlayElementImpl()

OverlayElement * Ogre::OverlayManager::createOverlayElementImpl ( const String & typeName,
const String & instanceName,
ElementMap & elementMap )
protected

◆ destroy() [1/2]

void Ogre::OverlayManager::destroy ( const String & name)

Destroys an existing overlay by name.

◆ destroy() [2/2]

void Ogre::OverlayManager::destroy ( Overlay * overlay)

Destroys an existing overlay.

◆ destroyAll()

void Ogre::OverlayManager::destroyAll ( void )

Destroys all existing overlays.

◆ destroyAllOverlayElements()

void Ogre::OverlayManager::destroyAllOverlayElements ( bool isTemplate = false)

Destroys all the OverlayElement created so far.

Remarks
Best to leave this to the engine to call internally, there should rarely be a need to call it yourself.

References isTemplate().

◆ destroyAllOverlayElementsImpl()

void Ogre::OverlayManager::destroyAllOverlayElementsImpl ( ElementMap & elementMap)
protected

◆ destroyOverlayElement() [1/2]

void Ogre::OverlayManager::destroyOverlayElement ( const String & instanceName,
bool isTemplate = false )

Destroys a OverlayElement.

Remarks
Make sure you're not still using this in an Overlay. If in doubt, let OGRE destroy elements on shutdown.

References isTemplate().

◆ destroyOverlayElement() [2/2]

void Ogre::OverlayManager::destroyOverlayElement ( OverlayElement * pInstance,
bool isTemplate = false )

Destroys a OverlayElement.

Remarks
Make sure you're not still using this in an Overlay. If in doubt, let OGRE destroy elements on shutdown.

References isTemplate().

◆ destroyOverlayElementImpl() [1/2]

void Ogre::OverlayManager::destroyOverlayElementImpl ( const String & instanceName,
ElementMap & elementMap )
protected

◆ destroyOverlayElementImpl() [2/2]

void Ogre::OverlayManager::destroyOverlayElementImpl ( OverlayElement * pInstance,
ElementMap & elementMap )
protected

◆ getByName()

Overlay * Ogre::OverlayManager::getByName ( const String & name)

Retrieve an Overlay by name.

Returns
A pointer to the Overlay, or 0 if not found

◆ getElementMap()

ElementMap & Ogre::OverlayManager::getElementMap ( bool isTemplate)
protected

References isTemplate().

◆ getLoadingOrder()

Real Ogre::OverlayManager::getLoadingOrder ( void ) const
virtual

Gets the relative loading order of scripts of this type.

Remarks
There are dependencies between some kinds of scripts, and to enforce this all implementors of this interface must define a loading order.
Returns
A value representing the relative loading order of these scripts compared to other script users, where higher values load later.

Implements Ogre::ScriptLoader.

◆ getOverlayElement()

OverlayElement * Ogre::OverlayManager::getOverlayElement ( const String & name,
bool isTemplate = false )

Gets a reference to an existing element.

References isTemplate().

◆ getOverlayElementFactoryMap()

const FactoryMap & Ogre::OverlayManager::getOverlayElementFactoryMap ( ) const

Get const access to the list of registered OverlayElement factories.

Definition at line 189 of file OgreOverlayManager.h.

References mFactories.

◆ getOverlayElementImpl()

OverlayElement * Ogre::OverlayManager::getOverlayElementImpl ( const String & name,
ElementMap & elementMap )
protected

◆ getOverlayIterator()

OverlayMapIterator Ogre::OverlayManager::getOverlayIterator ( void )

◆ getScriptPatterns()

const StringVector & Ogre::OverlayManager::getScriptPatterns ( void ) const
virtual

Gets the file patterns which should be used to find scripts for this class.

Remarks
This method is called when a resource group is loaded if you use ResourceGroupManager::_registerScriptLoader.
Returns
A list of file patterns, in the order they should be searched in.

Implements Ogre::ScriptLoader.

◆ getSingleton()

static OverlayManager & Ogre::OverlayManager::getSingleton ( void )
static

Override standard Singleton retrieval.

Remarks
Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll.
This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors.

References OverlayManager().

◆ getSingletonPtr()

static OverlayManager * Ogre::OverlayManager::getSingletonPtr ( void )
static

Override standard Singleton retrieval.

Remarks
Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll.
This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors.

References OverlayManager().

◆ getTemplateIterator()

TemplateIterator Ogre::OverlayManager::getTemplateIterator ( )

Returns an iterator over all templates in this manager.

Definition at line 205 of file OgreOverlayManager.h.

References mTemplates.

◆ getViewportAspectRatio()

Real Ogre::OverlayManager::getViewportAspectRatio ( void ) const

◆ getViewportHeight()

int Ogre::OverlayManager::getViewportHeight ( void ) const

Gets the height of the destination viewport in pixels.

◆ getViewportOrientationMode()

OrientationMode Ogre::OverlayManager::getViewportOrientationMode ( void ) const

Gets the orientation mode of the destination viewport.

◆ getViewportWidth()

int Ogre::OverlayManager::getViewportWidth ( void ) const

Gets the width of the destination viewport in pixels.

◆ hasOverlayElement()

bool Ogre::OverlayManager::hasOverlayElement ( const String & name,
bool isTemplate = false )

Tests if an element exists.

References isTemplate().

◆ hasOverlayElementImpl()

bool Ogre::OverlayManager::hasOverlayElementImpl ( const String & name,
ElementMap & elementMap )
protected

◆ hasViewportChanged()

bool Ogre::OverlayManager::hasViewportChanged ( void ) const

Method for determining if the viewport has changed dimensions.

Remarks
This is used by pixel-based OverlayElements to work out if they need to recalculate their sizes.

◆ isTemplate()

◆ operator delete() [1/6]

void Ogre::AllocatedObject< SceneObjAllocPolicy >::operator delete ( void * ptr)
inherited

Definition at line 96 of file OgreMemoryAllocatedObject.h.

◆ operator delete() [2/6]

void Ogre::AllocatedObject< SceneObjAllocPolicy >::operator delete ( void * ptr)
inherited

Definition at line 96 of file OgreMemoryAllocatedObject.h.

◆ operator delete() [3/6]

void Ogre::AllocatedObject< SceneObjAllocPolicy >::operator delete ( void * ptr,
const char * ,
int ,
const char *  )
inherited

Definition at line 108 of file OgreMemoryAllocatedObject.h.

◆ operator delete() [4/6]

void Ogre::AllocatedObject< SceneObjAllocPolicy >::operator delete ( void * ptr,
const char * ,
int ,
const char *  )
inherited

Definition at line 108 of file OgreMemoryAllocatedObject.h.

◆ operator delete() [5/6]

void Ogre::AllocatedObject< SceneObjAllocPolicy >::operator delete ( void * ptr,
void *  )
inherited

Definition at line 102 of file OgreMemoryAllocatedObject.h.

◆ operator delete() [6/6]

void Ogre::AllocatedObject< SceneObjAllocPolicy >::operator delete ( void * ptr,
void *  )
inherited

Definition at line 102 of file OgreMemoryAllocatedObject.h.

◆ operator delete[]() [1/4]

void Ogre::AllocatedObject< SceneObjAllocPolicy >::operator delete[] ( void * ptr)
inherited

Definition at line 113 of file OgreMemoryAllocatedObject.h.

◆ operator delete[]() [2/4]

void Ogre::AllocatedObject< SceneObjAllocPolicy >::operator delete[] ( void * ptr)
inherited

Definition at line 113 of file OgreMemoryAllocatedObject.h.

◆ operator delete[]() [3/4]

void Ogre::AllocatedObject< SceneObjAllocPolicy >::operator delete[] ( void * ptr,
const char * ,
int ,
const char *  )
inherited

Definition at line 119 of file OgreMemoryAllocatedObject.h.

◆ operator delete[]() [4/4]

void Ogre::AllocatedObject< SceneObjAllocPolicy >::operator delete[] ( void * ptr,
const char * ,
int ,
const char *  )
inherited

Definition at line 119 of file OgreMemoryAllocatedObject.h.

◆ operator new() [1/6]

void * Ogre::AllocatedObject< SceneObjAllocPolicy >::operator new ( size_t sz)
inherited

Definition at line 73 of file OgreMemoryAllocatedObject.h.

◆ operator new() [2/6]

void * Ogre::AllocatedObject< SceneObjAllocPolicy >::operator new ( size_t sz)
inherited

Definition at line 73 of file OgreMemoryAllocatedObject.h.

◆ operator new() [3/6]

void * Ogre::AllocatedObject< SceneObjAllocPolicy >::operator new ( size_t sz,
const char * file,
int line,
const char * func )
inherited

operator new, with debug line info

Definition at line 68 of file OgreMemoryAllocatedObject.h.

◆ operator new() [4/6]

void * Ogre::AllocatedObject< SceneObjAllocPolicy >::operator new ( size_t sz,
const char * file,
int line,
const char * func )
inherited

operator new, with debug line info

Definition at line 68 of file OgreMemoryAllocatedObject.h.

◆ operator new() [5/6]

void * Ogre::AllocatedObject< SceneObjAllocPolicy >::operator new ( size_t sz,
void * ptr )
inherited

placement operator new

Definition at line 79 of file OgreMemoryAllocatedObject.h.

◆ operator new() [6/6]

void * Ogre::AllocatedObject< SceneObjAllocPolicy >::operator new ( size_t sz,
void * ptr )
inherited

placement operator new

Definition at line 79 of file OgreMemoryAllocatedObject.h.

◆ operator new[]() [1/4]

void * Ogre::AllocatedObject< SceneObjAllocPolicy >::operator new[] ( size_t sz)
inherited

Definition at line 91 of file OgreMemoryAllocatedObject.h.

◆ operator new[]() [2/4]

void * Ogre::AllocatedObject< SceneObjAllocPolicy >::operator new[] ( size_t sz)
inherited

Definition at line 91 of file OgreMemoryAllocatedObject.h.

◆ operator new[]() [3/4]

void * Ogre::AllocatedObject< SceneObjAllocPolicy >::operator new[] ( size_t sz,
const char * file,
int line,
const char * func )
inherited

array operator new, with debug line info

Definition at line 86 of file OgreMemoryAllocatedObject.h.

◆ operator new[]() [4/4]

void * Ogre::AllocatedObject< SceneObjAllocPolicy >::operator new[] ( size_t sz,
const char * file,
int line,
const char * func )
inherited

array operator new, with debug line info

Definition at line 86 of file OgreMemoryAllocatedObject.h.

◆ parseAttrib()

void Ogre::OverlayManager::parseAttrib ( const String & line,
Overlay * pOverlay )
protected

◆ parseChildren()

bool Ogre::OverlayManager::parseChildren ( DataStreamPtr & chunk,
const String & line,
Overlay * pOverlay,
bool isTemplate,
OverlayContainer * parent = NULL )
protected

References isTemplate().

◆ parseElementAttrib()

void Ogre::OverlayManager::parseElementAttrib ( const String & line,
Overlay * pOverlay,
OverlayElement * pElement )
protected

◆ parseNewElement()

void Ogre::OverlayManager::parseNewElement ( DataStreamPtr & chunk,
String & elemType,
String & elemName,
bool isContainer,
Overlay * pOverlay,
bool isTemplate,
String templateName = String(""),
OverlayContainer * container = 0 )
protected

References isTemplate().

◆ parseScript()

void Ogre::OverlayManager::parseScript ( DataStreamPtr & stream,
const String & groupName )
virtual

Parse a script file.

Parameters
streamWeak reference to a data stream which is the source of the script
groupNameThe name of a resource group which should be used if any resources are created during the parse of this script.

Implements Ogre::ScriptLoader.

◆ skipToNextCloseBrace()

void Ogre::OverlayManager::skipToNextCloseBrace ( DataStreamPtr & chunk)
protected

◆ skipToNextOpenBrace()

void Ogre::OverlayManager::skipToNextOpenBrace ( DataStreamPtr & chunk)
protected

Member Data Documentation

◆ mFactories

FactoryMap Ogre::OverlayManager::mFactories
protected

Definition at line 75 of file OgreOverlayManager.h.

Referenced by getOverlayElementFactoryMap().

◆ mInstances

ElementMap Ogre::OverlayManager::mInstances
protected

Definition at line 77 of file OgreOverlayManager.h.

◆ mLastViewportHeight

int Ogre::OverlayManager::mLastViewportHeight
protected

Definition at line 68 of file OgreOverlayManager.h.

◆ mLastViewportOrientationMode

OrientationMode Ogre::OverlayManager::mLastViewportOrientationMode
protected

Definition at line 70 of file OgreOverlayManager.h.

◆ mLastViewportWidth

int Ogre::OverlayManager::mLastViewportWidth
protected

Definition at line 68 of file OgreOverlayManager.h.

◆ mLoadedScripts

LoadedScripts Ogre::OverlayManager::mLoadedScripts
protected

Definition at line 81 of file OgreOverlayManager.h.

◆ mOverlayMap

OverlayMap Ogre::OverlayManager::mOverlayMap
protected

Definition at line 58 of file OgreOverlayManager.h.

◆ mScriptPatterns

StringVector Ogre::OverlayManager::mScriptPatterns
protected

Definition at line 59 of file OgreOverlayManager.h.

◆ msSingleton

OverlayManager* Ogre::Singleton< OverlayManager >::msSingleton
staticprotectedinherited

Definition at line 75 of file OgreSingleton.h.

◆ mTemplates

ElementMap Ogre::OverlayManager::mTemplates
protected

Definition at line 78 of file OgreOverlayManager.h.

Referenced by getTemplateIterator(), and isTemplate().

◆ mViewportDimensionsChanged

bool Ogre::OverlayManager::mViewportDimensionsChanged
protected

Definition at line 69 of file OgreOverlayManager.h.


The documentation for this class was generated from the following file: