OGRE: Ogre::OverlayManager Class Reference - OGRE Documentation

Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes

# Ogre::OverlayManager Class Reference
[Overlays]

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

`#include <OgreOverlayManager.h>`

Inheritance diagram for Ogre::OverlayManager:
[legend]

List of all members.

## Public Types
typedef map< String, Overlay * > ::type | OverlayMap
typedef map< String, OverlayElement * >::type | ElementMap
typedef map< String, OverlayElementFactory * > ::type | FactoryMap
typedef MapIterator< OverlayMap > | OverlayMapIterator
typedef MapIterator< ElementMap > | TemplateIterator
## Public Member Functions
| OverlayManager ()
virtual | ~OverlayManager ()
const StringVector & | getScriptPatterns (void) const
void | parseScript (DataStreamPtr &stream, const String &groupName)
Real | getLoadingOrder (void) const
Overlay * | create (const String &name)
| Create a new Overlay.
Overlay * | getByName (const String &name)
| Retrieve an Overlay by name.
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.
OverlayMapIterator | getOverlayIterator (void)
void | _queueOverlaysForRendering (Camera *cam, RenderQueue *pQueue, Viewport *vp)
| Internal method for queueing the visible overlays for rendering.
bool | hasViewportChanged (void) const
| Method for determining if the viewport has changed dimensions.
int | getViewportHeight (void) const
| Gets the height of the destination viewport in pixels.
int | getViewportWidth (void) const
| Gets the width of the destination viewport in pixels.
Real | getViewportAspectRatio (void) const
OrientationMode | getViewportOrientationMode (void) const
| Gets the orientation mode of the destination viewport.
OverlayElement * | createOverlayElement (const String &typeName, const String &instanceName, bool isTemplate=false)
| Creates a new OverlayElement of the type requested.
OverlayElement * | getOverlayElement (const String &name, bool isTemplate=false)
| Gets a reference to an existing element.
bool | hasOverlayElement (const String &name, bool isTemplate=false)
| Tests if an element exists.
void | destroyOverlayElement (const String &instanceName, bool isTemplate=false)
| Destroys a OverlayElement.
void | destroyOverlayElement (OverlayElement *pInstance, bool isTemplate=false)
| Destroys a OverlayElement.
void | destroyAllOverlayElements (bool isTemplate=false)
| Destroys all the OverlayElement created so far.
void | addOverlayElementFactory (OverlayElementFactory *elemFactory)
| Registers a new OverlayElementFactory with this manager.
const FactoryMap & | getOverlayElementFactoryMap () const
| Get const access to the list of registered OverlayElement factories.
OverlayElement * | createOverlayElementFromTemplate (const String &templateName, const String &typeName, const String &instanceName, bool isTemplate=false)
OverlayElement * | cloneOverlayElementFromTemplate (const String &templateName, const String &instanceName)
OverlayElement * | createOverlayElementFromFactory (const String &typeName, const String &instanceName)
TemplateIterator | getTemplateIterator ()
| Returns an iterator over all templates in this manager.
bool | isTemplate (String strName) const
virtual const StringVector & | getScriptPatterns (void) const =0
| Gets the file patterns which should be used to find scripts for this class.
virtual void | parseScript (DataStreamPtr &stream, const String &groupName)=0
| Parse a script file.
virtual Real | getLoadingOrder (void) const =0
| Gets the relative loading order of scripts of this type.
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 * | operator new (size_t sz, void *ptr)
| placement operator new
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)
void | operator delete (void *ptr)
void | operator delete (void *ptr, void *)
void | operator delete (void *ptr, const char *, int, const char *)
void | operator delete[] (void *ptr)
void | operator delete[] (void *ptr, const char *, int, const char *)
## Static Public Member Functions
static OverlayManager & | getSingleton (void)
| Override standard Singleton retrieval.
static OverlayManager * | getSingletonPtr (void)
| Override standard Singleton retrieval.
static OverlayManager & | getSingleton (void)
static OverlayManager * | getSingletonPtr (void)
## Protected Types
typedef set< String >::type | LoadedScripts
## Protected Member Functions
void | parseNewElement (DataStreamPtr &chunk, String &elemType, String &elemName, bool isContainer, Overlay *pOverlay, bool isTemplate, String templateName=String(""), OverlayContainer *container=0)
void | parseAttrib (const String &line, Overlay *pOverlay)
void | parseElementAttrib (const String &line, Overlay *pOverlay, OverlayElement *pElement)
void | skipToNextCloseBrace (DataStreamPtr &chunk)
void | skipToNextOpenBrace (DataStreamPtr &chunk)
bool | parseChildren (DataStreamPtr &chunk, const String &line, Overlay *pOverlay, bool isTemplate, OverlayContainer *parent=NULL)
ElementMap & | getElementMap (bool isTemplate)
OverlayElement * | createOverlayElementImpl (const String &typeName, const String &instanceName, ElementMap &elementMap)
OverlayElement * | getOverlayElementImpl (const String &name, ElementMap &elementMap)
bool | hasOverlayElementImpl (const String &name, ElementMap &elementMap)
void | destroyOverlayElementImpl (const String &instanceName, ElementMap &elementMap)
void | destroyOverlayElementImpl (OverlayElement *pInstance, ElementMap &elementMap)
void | destroyAllOverlayElementsImpl (ElementMap &elementMap)
## Protected Attributes
OverlayMap | mOverlayMap
StringVector | mScriptPatterns
int | mLastViewportWidth
int | mLastViewportHeight
bool | mViewportDimensionsChanged
OrientationMode | mLastViewportOrientationMode
FactoryMap | mFactories
ElementMap | mInstances
ElementMap | mTemplates
LoadedScripts | mLoadedScripts
## Static Protected Attributes
static OverlayManager * | ms_Singleton

## Detailed Description

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

Alo 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

typedef map<String, OverlayElement*>::type Ogre::OverlayManager::ElementMap

Definition at line 55 of file OgreOverlayManager.h.

typedef map<String, OverlayElementFactory*>::type Ogre::OverlayManager::FactoryMap

Definition at line 56 of file OgreOverlayManager.h.

typedef set<String>::type Ogre::OverlayManager::LoadedScripts`[protected]`

Definition at line 80 of file OgreOverlayManager.h.

typedef map<String, Overlay*>::type Ogre::OverlayManager::OverlayMap

Definition at line 54 of file OgreOverlayManager.h.

typedef MapIterator<OverlayMap> Ogre::OverlayManager::OverlayMapIterator

Definition at line 123 of file OgreOverlayManager.h.

typedef MapIterator<ElementMap> Ogre::OverlayManager::TemplateIterator

Definition at line 203 of file OgreOverlayManager.h.

## Constructor & Destructor Documentation

Ogre::OverlayManager::OverlayManager | ( |  | ) |

virtual Ogre::OverlayManager::~OverlayManager | ( |  | ) | `[virtual]`

## Member Function Documentation

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

Internal method for queueing the visible overlays for rendering.

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.

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.

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

Create a new Overlay.

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:

  | typeName | The type of element to create.
  | instanceName | The name to give the new instance.

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

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

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

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

Destroys an existing overlay by name.

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

Destroys an existing overlay.

void Ogre::OverlayManager::destroyAll | ( | void |  | ) |

Destroys all existing overlays.

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.

void Ogre::OverlayManager::destroyAllOverlayElementsImpl | ( | ElementMap & | elementMap | ) | `[protected]`

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.

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.

void Ogre::OverlayManager::destroyOverlayElementImpl | ( | const String & | instanceName,
|  | ElementMap & | elementMap |
| ) |  |  | `[protected]`

void Ogre::OverlayManager::destroyOverlayElementImpl | ( | OverlayElement * | pInstance,
|  | ElementMap & | elementMap |
| ) |  |  | `[protected]`

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

Retrieve an Overlay by name.

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

ElementMap& Ogre::OverlayManager::getElementMap | ( | bool | isTemplate | ) | `[protected]`

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

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.

virtual Real Ogre::ScriptLoader::getLoadingOrder | ( | void |  | ) | const`[pure virtual, inherited]`

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.

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

Gets a reference to an existing element.

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

Get const access to the list of registered OverlayElement factories.

Definition at line 189 of file OgreOverlayManager.h.

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

OverlayMapIterator Ogre::OverlayManager::getOverlayIterator | ( | void |  | ) |

virtual const StringVector& Ogre::ScriptLoader::getScriptPatterns | ( | void |  | ) | const`[pure virtual, inherited]`

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.

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

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.

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.

static OverlayManager & Ogre::Singleton< OverlayManager >::getSingleton | ( | void |  | ) | `[static, inherited]`

Definition at line 90 of file OgreSingleton.h.

static OverlayManager * Ogre::Singleton< OverlayManager >::getSingletonPtr | ( | void |  | ) | `[static, inherited]`

Definition at line 92 of file OgreSingleton.h.

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.

TemplateIterator Ogre::OverlayManager::getTemplateIterator | ( |  | ) |

Returns an iterator over all templates in this manager.

Definition at line 205 of file OgreOverlayManager.h.

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

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

Gets the height of the destination viewport in pixels.

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

Gets the orientation mode of the destination viewport.

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

Gets the width of the destination viewport in pixels.

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

Tests if an element exists.

bool Ogre::OverlayManager::hasOverlayElementImpl | ( | const String & | name,
|  | ElementMap & | elementMap |
| ) |  |  | `[protected]`

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.

bool Ogre::OverlayManager::isTemplate | ( | String | strName | ) | const

Definition at line 210 of file OgreOverlayManager.h.

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr,
|  | void * |  |
| ) |  |  | `[inherited]`

Definition at line 101 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr | ) | `[inherited]`

Definition at line 95 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

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

Definition at line 107 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr | ) | `[inherited]`

Definition at line 112 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

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

Definition at line 118 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

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

operator new, with debug line info

Definition at line 67 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz,
|  | void * | ptr |
| ) |  |  | `[inherited]`

placement operator new

Definition at line 78 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

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

Definition at line 72 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

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

Definition at line 90 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

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

array operator new, with debug line info

Definition at line 85 of file OgreMemoryAllocatedObject.h.

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

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

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

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

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

Parse a script file.

Parameters:

  | stream | Weak reference to a data stream which is the source of the script
  | groupName | The name of a resource group which should be used if any resources are created during the parse of this script.

virtual void Ogre::ScriptLoader::parseScript | ( | DataStreamPtr & | stream,
|  | const String & | groupName |
| ) |  |  | `[pure virtual, inherited]`

Parse a script file.

Parameters:

  | stream | Weak reference to a data stream which is the source of the script
  | groupName | The name of a resource group which should be used if any resources are created during the parse of this script.

void Ogre::OverlayManager::skipToNextCloseBrace | ( | DataStreamPtr & | chunk | ) | `[protected]`

void Ogre::OverlayManager::skipToNextOpenBrace | ( | DataStreamPtr & | chunk | ) | `[protected]`

## Member Data Documentation

FactoryMap Ogre::OverlayManager::mFactories`[protected]`

Definition at line 75 of file OgreOverlayManager.h.

ElementMap Ogre::OverlayManager::mInstances`[protected]`

Definition at line 77 of file OgreOverlayManager.h.

int Ogre::OverlayManager::mLastViewportHeight`[protected]`

Definition at line 68 of file OgreOverlayManager.h.

OrientationMode Ogre::OverlayManager::mLastViewportOrientationMode`[protected]`

Definition at line 70 of file OgreOverlayManager.h.

int Ogre::OverlayManager::mLastViewportWidth`[protected]`

Definition at line 68 of file OgreOverlayManager.h.

LoadedScripts Ogre::OverlayManager::mLoadedScripts`[protected]`

Definition at line 81 of file OgreOverlayManager.h.

OverlayMap Ogre::OverlayManager::mOverlayMap`[protected]`

Definition at line 58 of file OgreOverlayManager.h.

OverlayManager * Ogre::Singleton< OverlayManager >::ms_Singleton`[static, protected, inherited]`

Definition at line 75 of file OgreSingleton.h.

StringVector Ogre::OverlayManager::mScriptPatterns`[protected]`

Definition at line 59 of file OgreOverlayManager.h.

ElementMap Ogre::OverlayManager::mTemplates`[protected]`

Definition at line 78 of file OgreOverlayManager.h.

bool Ogre::OverlayManager::mViewportDimensionsChanged`[protected]`

Definition at line 69 of file OgreOverlayManager.h.

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

- OgreOverlayManager.h

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Wed Nov 3 2010 19:24:57