syBR::Game::GUIManager Class Reference

GUI manager class. More...

#include <GUIManager.hpp>

List of all members.

Public Types

enum  RenderPosition {
  RP_BEFORE_BACKGROUND = 0, RP_AFTER_BACKGROUND = 1, RP_BEFORE_FOREGROUND = 2, RP_AFTER_FOREGROUND = 3,
  RP_COUNT = 4
}
 Render position of the GUI. More...

Public Member Functions

 GUIManager (Core::Logger *pLogger)
 Constructor.
 ~GUIManager ()
 Destructor.
const bool hasLogger () const
 Indicate if a logger is used for all GUI-related stuff.
Core::LoggergetLogger ()
 Get the logger used for all GUI-related stuff.
bool load (const std::string &name, const std::string &filename, const RenderPosition position)
 Load a GUI and put in the list of disabled GUIs.
bool save () const
 Save a GUI.
bool loadFont (const std::string &name)
 Load a font.
GUIFontgetFont (const std::string &name) const
 Get a font.
void enable (const std::string &name)
 Enable GUI rendering.
void disable (const std::string &name)
 Disable GUI rendering.
void renderQueueStarted (Ogre::uint8 id, const Ogre::String &invocation, bool &skipThisQueue)
 Inherited from Ogre::RenderQueueListener.
void renderQueueEnded (Ogre::uint8 id, const Ogre::String &invocation, bool &repeatThisQueue)
 Inherited from Ogre::RenderQueueListener.

Private Member Functions

void initializeRendering ()
 Initialize GUI rendering.
void render (GUIContainer *pRootWidget)
 Render a GUI.
void createHardwareBuffer (size_t vertexCount)
 Create a rendering buffer.
const Ogre::uint32 convertOgreColour (const Ogre::ColourValue &colour) const
 Convert an Ogre colour value to a colour format accepted by the renderer.

Private Attributes

Core::Loggerm_pLogger
 Pointer to the logger to be used.
Ogre::SceneManager * m_pRenderSceneManager
 Ogre scene manager to be used for rendering.
Ogre::RenderSystem * m_pRenderSystem
 Ogre render system.
Ogre::Vector2 m_texelOffset
 Texel offset to be used for perfect texel to pixel mapping.
Ogre::LayerBlendModeEx m_textureColourBlendingMode
 Texture colour blending mode (render state).
Ogre::LayerBlendModeEx m_textureAlphaBlendingMode
 Texture alpha blending mode (render state).
Ogre::TextureUnitState::UVWAddressingMode m_textureAddressingMode
 Texture addressing mode (render state).
Ogre::RenderOperation m_renderOperation
 Ogre rendering operation description.
Ogre::HardwareVertexBufferSharedPtr m_hardwareBuffer
 Ogre hardware buffer used to store vertices.
size_t m_hardwareBufferSize
 Maximum number of vertices in the buffer.
unsigned short int m_currentBufferUnderUsedFrameCount
 Current number of frames where the hardware buffer was under- used.
std::map
< std::string,
GUIFont * > 
m_mapFonts
 Loaded fonts.
std::vector< Descriptorm_vEnabledGUIs
 Enabled GUIS.
std::vector< Descriptorm_vDisabledGUIs
 Disabled GUIs.

Static Private Attributes

static const
unsigned short int 
MAX_UNDER_USED_BUFFER_FRAME_COUNT = 50000
 Number of frames to wait before resizing the hardware buffer when it is under-used.

Classes

struct  Descriptor
 Structure describing a GUI. More...
struct  Quad
 Structure describing a quad. More...
struct  Vertex
 Structure used internally to describe a vertex. More...


Detailed Description

GUI manager class.

It is the object responsible for managing all the resources of a GUI. It is also responsible of managing the rendering of the GUI by calling appropriate functions from the renderer.

Rendering system must be initialized before any GUIManager is created, failure to do so will results in errors.


Member Enumeration Documentation

enum syBR::Game::GUIManager::RenderPosition

Render position of the GUI.

Enumerator:
RP_BEFORE_BACKGROUND  Behind anything rendered in the background queue.
RP_AFTER_BACKGROUND  In front of anything rendered in the background queue.
RP_BEFORE_FOREGROUND  Behind anything rendered in the foreground queue.
RP_AFTER_FOREGROUND  In front of anything rendered in the foreground queue.
RP_COUNT  Last entry in the enum.


Constructor & Destructor Documentation

syBR::Game::GUIManager::GUIManager ( Core::Logger pLogger  ) 

Constructor.

Parameters:
pLogger Pointer to the instance of the logger to use

syBR::Game::GUIManager::~GUIManager (  ) 

Destructor.


Member Function Documentation

const bool syBR::Game::GUIManager::hasLogger (  )  const

Indicate if a logger is used for all GUI-related stuff.

Returns:
One of these:
  • true if a logger has been specified
  • false otherwise

Core::Logger * syBR::Game::GUIManager::getLogger (  ) 

Get the logger used for all GUI-related stuff.

Returns:
Pointer to the logger instance

bool syBR::Game::GUIManager::load ( const std::string &  name,
const std::string &  filename,
const RenderPosition  position 
)

Load a GUI and put in the list of disabled GUIs.

Parameters:
name Name to assign to the GUI being loaded
filename Filename of the GUI definition file
position Position of the GUI regarding other objects in the scene
Returns:
One of these:
  • true if GUI was successfully loaded
  • false otherwise

bool syBR::Game::GUIManager::save (  )  const

Save a GUI.

Returns:
One of these:
  • true if GUI was successfully saved
  • false otherwise

bool syBR::Game::GUIManager::loadFont ( const std::string &  name  ) 

Load a font.

Parameters:
name Name of the font to load
Returns:
One of these:
  • true in case of success
  • false otherwise

GUIFont * syBR::Game::GUIManager::getFont ( const std::string &  name  )  const

Get a font.

Parameters:
name Name of the font to retrieve
Returns:
One of these:
  • Pointer to the requested font if it has been loaded
  • NULL otherwise

void syBR::Game::GUIManager::enable ( const std::string &  name  ) 

Enable GUI rendering.

Parameters:
name Name of the GUI for which rendering must be enabled

void syBR::Game::GUIManager::disable ( const std::string &  name  ) 

Disable GUI rendering.

Parameters:
name Name of the GUI for which rendering must be disabled

void syBR::Game::GUIManager::renderQueueStarted ( Ogre::uint8  id,
const Ogre::String &  invocation,
bool &  skipThisQueue 
)

Inherited from Ogre::RenderQueueListener.

Render GUIs setup to be rendered with the specified queue id, if they must be rendered BEFORE that queue.

void syBR::Game::GUIManager::renderQueueEnded ( Ogre::uint8  id,
const Ogre::String &  invocation,
bool &  repeatThisQueue 
)

Inherited from Ogre::RenderQueueListener.

Render GUIs setup to be rendered with the specified queue id, if they must be rendered AFTER that queue.

void syBR::Game::GUIManager::initializeRendering (  )  [private]

Initialize GUI rendering.

void syBR::Game::GUIManager::render ( GUIContainer pRootWidget  )  [private]

Render a GUI.

Parameters:
pRootWidget Root element of the GUI to be rendered

void syBR::Game::GUIManager::createHardwareBuffer ( size_t  vertexCount  )  [private]

Create a rendering buffer.

Parameters:
vertexCount Maximum number of vertices in the buffer to be created

const Ogre::uint32 syBR::Game::GUIManager::convertOgreColour ( const Ogre::ColourValue &  colour  )  const [private]

Convert an Ogre colour value to a colour format accepted by the renderer.

Parameters:
colour Colour to convert
Returns:
Converted colour


Member Data Documentation

const unsigned short int syBR::Game::GUIManager::MAX_UNDER_USED_BUFFER_FRAME_COUNT = 50000 [static, private]

Number of frames to wait before resizing the hardware buffer when it is under-used.

Core::Logger* syBR::Game::GUIManager::m_pLogger [private]

Pointer to the logger to be used.

Ogre::SceneManager* syBR::Game::GUIManager::m_pRenderSceneManager [private]

Ogre scene manager to be used for rendering.

Ogre::RenderSystem* syBR::Game::GUIManager::m_pRenderSystem [private]

Ogre render system.

Ogre::Vector2 syBR::Game::GUIManager::m_texelOffset [private]

Texel offset to be used for perfect texel to pixel mapping.

Ogre::LayerBlendModeEx syBR::Game::GUIManager::m_textureColourBlendingMode [private]

Texture colour blending mode (render state).

Ogre::LayerBlendModeEx syBR::Game::GUIManager::m_textureAlphaBlendingMode [private]

Texture alpha blending mode (render state).

Ogre::TextureUnitState::UVWAddressingMode syBR::Game::GUIManager::m_textureAddressingMode [private]

Texture addressing mode (render state).

Ogre::RenderOperation syBR::Game::GUIManager::m_renderOperation [private]

Ogre rendering operation description.

Ogre::HardwareVertexBufferSharedPtr syBR::Game::GUIManager::m_hardwareBuffer [private]

Ogre hardware buffer used to store vertices.

size_t syBR::Game::GUIManager::m_hardwareBufferSize [private]

Maximum number of vertices in the buffer.

unsigned short int syBR::Game::GUIManager::m_currentBufferUnderUsedFrameCount [private]

Current number of frames where the hardware buffer was under- used.

std::map<std::string, GUIFont*> syBR::Game::GUIManager::m_mapFonts [private]

Loaded fonts.

std::vector<Descriptor> syBR::Game::GUIManager::m_vEnabledGUIs [private]

Enabled GUIS.

std::vector<Descriptor> syBR::Game::GUIManager::m_vDisabledGUIs [private]

Disabled GUIs.


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

Copyright © 2008 by Sebastien Frippiat
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.
Last modified Tue Dec 30 17:57:33 2008