#include <GUIManager.hpp>
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::Logger * | getLogger () |
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. | |
GUIFont * | getFont (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::Logger * | m_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< Descriptor > | m_vEnabledGUIs |
Enabled GUIS. | |
std::vector< Descriptor > | m_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... |
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.
Render position of the GUI.
syBR::Game::GUIManager::GUIManager | ( | Core::Logger * | pLogger | ) |
Constructor.
pLogger | Pointer to the instance of the logger to use |
syBR::Game::GUIManager::~GUIManager | ( | ) |
Destructor.
const bool syBR::Game::GUIManager::hasLogger | ( | ) | const |
Indicate if a logger is used for all GUI-related stuff.
Core::Logger * syBR::Game::GUIManager::getLogger | ( | ) |
Get the logger used for all GUI-related stuff.
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.
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 |
bool syBR::Game::GUIManager::save | ( | ) | const |
Save a GUI.
bool syBR::Game::GUIManager::loadFont | ( | const std::string & | name | ) |
Load a font.
name | Name of the font to load |
GUIFont * syBR::Game::GUIManager::getFont | ( | const std::string & | name | ) | const |
Get a font.
name | Name of the font to retrieve |
void syBR::Game::GUIManager::enable | ( | const std::string & | name | ) |
Enable GUI rendering.
name | Name of the GUI for which rendering must be enabled |
void syBR::Game::GUIManager::disable | ( | const std::string & | name | ) |
Disable GUI rendering.
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.
pRootWidget | Root element of the GUI to be rendered |
void syBR::Game::GUIManager::createHardwareBuffer | ( | size_t | vertexCount | ) | [private] |
Create a rendering buffer.
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.
colour | Colour to convert |
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.
Copyright © 2008 by Sebastien Frippiat
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.
Last modified Tue Dec 30 17:57:33 2008