OGRE 14.3
Object-Oriented Graphics Rendering Engine
Loading...
Searching...
No Matches
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 std::map< String, OverlayElement * > ElementMap
 
typedef std::map< String, OverlayElementFactory * > FactoryMap
 
typedef std::map< String, Overlay * > OverlayMap
 
typedef MapIterator< OverlayMapOverlayMapIterator
 

Public Member Functions

 OverlayManager ()
 
virtual ~OverlayManager ()
 
void _queueOverlaysForRendering (Camera *cam, RenderQueue *pQueue, Viewport *vp)
 Internal method for queueing the visible overlays for rendering.
 
void _releaseManualHardwareResources ()
 Notifies that hardware resources were lost.
 
void _restoreManualHardwareResources ()
 Notifies that hardware resources should be restored.
 
void addOverlay (Overlay *overlay)
 
void addOverlayElementFactory (OverlayElementFactory *elemFactory)
 Registers a new OverlayElementFactory with this manager.
 
OverlayElementcloneOverlayElementFromTemplate (const String &templateName, const String &instanceName)
 Creates a new OverlayElement object from the specified template name.
 
Overlaycreate (const String &name)
 Create a new Overlay.
 
OverlayElementcreateOverlayElement (const String &typeName, const String &instanceName, bool=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=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=false)
 Destroys all the OverlayElement created so far.
 
void destroyOverlayElement (const String &instanceName, bool=false)
 Destroys a OverlayElement.
 
void destroyOverlayElement (OverlayElement *pInstance, bool=false)
 Destroys a OverlayElement.
 
OverlaygetByName (const String &name)
 Retrieve an Overlay by name.
 
Real getLoadingOrder (void) const override
 Gets the loading order for scripts of this type.
 
OverlayElementgetOverlayElement (const String &name, bool=false)
 Gets a reference to an existing element.
 
const FactoryMapgetOverlayElementFactoryMap () const
 Get const access to the list of registered OverlayElement factories.
 
OverlayMapIterator getOverlayIterator (void)
 
float getPixelRatio () const
 
const StringVectorgetScriptPatterns (void) const override
 Gets the file patterns which should be used to find scripts for this class.
 
Real getViewportAspectRatio (void) const
 
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.
 
bool hasOverlayElement (const String &name, bool=false)
 Tests if an element exists.
 
void parseScript (DataStreamPtr &stream, const String &groupName) override
 Parse a script file.
 
void setPixelRatio (float ratio)
 Sets the pixel ratio: how many viewport pixels represent a single overlay pixel (in one dimension).
 
- Public Member Functions inherited from Ogre::Singleton< OverlayManager >
 Singleton (void)
 
 ~Singleton (void)
 
- Public Member Functions inherited from Ogre::ScriptLoader
virtual ~ScriptLoader ()
 

Static Public Member Functions

static OverlayManagergetSingleton (void)
 Override standard Singleton retrieval.
 
static OverlayManagergetSingletonPtr (void)
 Get the singleton instance.
 
- Static Public Member Functions inherited from Ogre::Singleton< OverlayManager >
static OverlayManagergetSingleton (void)
 Get the singleton instance.
 
static OverlayManagergetSingletonPtr (void)
 Get the singleton instance.
 

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.

Member Typedef Documentation

◆ OverlayMap

◆ ElementMap

◆ FactoryMap

◆ OverlayMapIterator

Constructor & Destructor Documentation

◆ OverlayManager()

Ogre::OverlayManager::OverlayManager ( )

◆ ~OverlayManager()

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

Member Function Documentation

◆ _releaseManualHardwareResources()

void Ogre::OverlayManager::_releaseManualHardwareResources ( )

Notifies that hardware resources were lost.

◆ _restoreManualHardwareResources()

void Ogre::OverlayManager::_restoreManualHardwareResources ( )

Notifies that hardware resources should be restored.

◆ getScriptPatterns()

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

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

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.

◆ parseScript()

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

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.

◆ getLoadingOrder()

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

Gets the loading order for scripts of this type.

There are dependencies between some kinds of scripts, and this value enumerates that. Higher values load later during bulk loading tasks.

Returns
The loading order

Implements Ogre::ScriptLoader.

◆ addOverlay()

void Ogre::OverlayManager::addOverlay ( Overlay overlay)

◆ create()

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

Create a new Overlay.

◆ getByName()

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

Retrieve an Overlay by name.

For example, one defined in some .overlay file.

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

◆ 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.

◆ getOverlayIterator()

OverlayMapIterator Ogre::OverlayManager::getOverlayIterator ( void  )

◆ _queueOverlaysForRendering()

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

Internal method for queueing the visible overlays for rendering.

◆ getViewportHeight()

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

Gets the height of the destination viewport in pixels.

◆ getViewportWidth()

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

Gets the width of the destination viewport in pixels.

◆ getViewportAspectRatio()

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

◆ setPixelRatio()

void Ogre::OverlayManager::setPixelRatio ( float  ratio)

Sets the pixel ratio: how many viewport pixels represent a single overlay pixel (in one dimension).

By default this is an 1:1 mapping. However on HiDPI screens you want to increase that to scale up your Overlay.

See also
RenderWindow::getViewPointToPixelScale

◆ getPixelRatio()

float Ogre::OverlayManager::getPixelRatio ( ) const

◆ createOverlayElement()

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

Creates a new OverlayElement of the type requested.

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.

◆ getOverlayElement()

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

Gets a reference to an existing element.

◆ hasOverlayElement()

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

Tests if an element exists.

◆ destroyOverlayElement() [1/2]

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

Destroys a OverlayElement.

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

◆ destroyOverlayElement() [2/2]

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

Destroys a OverlayElement.

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

◆ destroyAllOverlayElements()

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

Destroys all the OverlayElement created so far.

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

◆ addOverlayElementFactory()

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

Registers a new OverlayElementFactory with this manager.

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

◆ getOverlayElementFactoryMap()

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

Get const access to the list of registered OverlayElement factories.

◆ createOverlayElementFromTemplate()

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

◆ cloneOverlayElementFromTemplate()

OverlayElement * Ogre::OverlayManager::cloneOverlayElementFromTemplate ( const String templateName,
const String instanceName 
)

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.

◆ createOverlayElementFromFactory()

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

◆ getSingleton()

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

Override standard Singleton retrieval.

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.

◆ getSingletonPtr()

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

Get the singleton instance.


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