EPOC::GraphicsManager Class Reference

#include <GraphicsManager.h>

Inheritance diagram for EPOC::GraphicsManager:

Inheritance graph
[legend]
Collaboration diagram for EPOC::GraphicsManager:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 GraphicsManager (Application *pApplication)
virtual ~GraphicsManager ()
virtual void Cleanup ()
virtual bool Initialize ()
virtual bool Update (float fTimeDelta)
virtual void Render (TextureSDL *pDestSurface)
virtual void AddRenderObject (GraphicsObject *pObject)
virtual void AddImageObject (Image *pObject)
virtual void RemoveImageObject (Image *pObject)
virtual void AddAnimationObject (Animation *pObject)
virtual void RemoveAnimationObject (Animation *pObject)
virtual void AddTextObject (Text *pObject)
virtual void RemoveTextObject (Text *pObject)
virtual ImageCreateImage (std::string sFilePath, bool bExclusive=false, bool bEditable=false)
virtual ImageCreateImage (Texture *pTexture)
virtual void DestroyImage (Image *pImage)
virtual AnimationCreateAnimation (std::string sFilePath, bool bExclusive=false, bool bEditable=false)
virtual AnimationCreateAnimation (Texture *pTexture)
virtual void DestroyAnimation (Animation *pAnimation)
virtual TextCreateText (std::string sText, ColorRGB rTextColor=ColorRGB(255, 255, 255), int nFontSize=DEFAULT_FONT_SIZE, std::string sFontPath=DEFAULT_FONT)
virtual void DestroyText (Text *pText)
virtual TextureCreateTexture (std::string sName, bool bExclusive=false, bool bEditable=false)
virtual bool DestroyTexture (Texture *pTexture)
virtual TextureLoadTextureFromFile (std::string sFilePath, bool bExclusive=false, bool bEditable=false)
virtual TextureGetTexture (std::string sName)
virtual void AddTexture (Texture *pTexture)
virtual bool RemoveTexture (Texture *pTexture)
virtual void SetRenderSorting (bool bStatus)
virtual void SetClearColor (ColorRGB rColor)
bool IsDebugInfoEnabled ()
void SetDebugInfo (bool bStatus)
bool IsRenderSortingEnabled ()

Protected Member Functions

virtual bool InitializeOpenGL ()
virtual void RenderSDL (TextureSDL *pDestSurface)
virtual void RenderOGL (TextureSDL *pDestSurface)
virtual bool UpdateDebugInformation (float fTimeDelta)
virtual void SortRenderContainer (std::vector< class GraphicsObject * > *pRenderContainer)
virtual void SortAlphaRenderContainer (std::vector< class GraphicsObject * > *pRenderContainer)

Static Protected Member Functions

static int ZOrderGreater (GraphicsObject *pObject1, class GraphicsObject *pObject2)
static int ZOrderSmaller (GraphicsObject *pObject1, class GraphicsObject *pObject2)

Protected Attributes

int m_nFrameCounter
int m_nRenderCandidates
int m_nRenderedObjects
bool m_bShowDebugInfo
bool m_bSortRenderContainer
Textm_pDebugText
ColorRGB m_rClearColor
std::list< GraphicsObject * > m_rImages
std::list< GraphicsObject * > m_rAnimations
std::list< GraphicsObject * > m_rTexts
std::list< std::list
< GraphicsObject * > * > 
m_rUpdateContainer
std::vector< GraphicsObject * > m_rRenderContainer
std::vector< GraphicsObject * > m_rAlphaRenderContainer
std::list< Texture * > m_rTextures
Applicationm_pApplication


Detailed Description

Graphics manager class This class handle, create and destroy all graphical resources in EPOC.

Constructor & Destructor Documentation

GraphicsManager::GraphicsManager ( Application pApplication  ) 

Contructor Resets all members to the default values

GraphicsManager::~GraphicsManager (  )  [virtual]

Destructor Calls Cleanup()

See also:
Cleanup()


Member Function Documentation

void GraphicsManager::Cleanup (  )  [virtual]

Cleans up any relevant data

See also:
~GraphicsManager()

bool GraphicsManager::Initialize (  )  [virtual]

Initializes any relevant data

Returns:
False if the initialization fails, true if it succeeds.

bool GraphicsManager::Update ( float  fTimeDelta  )  [virtual]

Updates the animation

Remarks:
This function is called once per frame internally by EpEngine
Parameters:
fTimeDelta the time that has passed since last update, measured in milliseconds
Returns:
true if the update succeeded and false if it didn't

Reimplemented from EPOC::BaseObject.

void GraphicsManager::Render ( TextureSDL pDestSurface  )  [virtual]

Renders all graphical content created by this manager

Remarks:
This function is called once per frame internally by EpEngine
Parameters:
pDestSurface The SDL surface on which to render the graphical content

void GraphicsManager::AddRenderObject ( GraphicsObject pObject  )  [virtual]

Adds a pointer to a GraphicsObject to the render container.

Parameters:
pObject Pointer to the GraphicsObject to add to the render container.
Remarks:
You normally shouldn't have to use this method!! It's mostly used internally by EPOC, but is also available for more advanced cases. The graphics manager adds all graphical content that it creates to this container automaticly.

void GraphicsManager::AddImageObject ( Image pObject  )  [virtual]

Adds a pointer to a Image object to the image container.

Parameters:
pObject Pointer to the Image to add to the image container.
Remarks:
You normally shouldn't have to use this method!! It's mostly used internally by EPOC, but is also available for more advanced cases. Use the Create and Destroy equivalents instead.
See also:
CreateImage()

void GraphicsManager::RemoveImageObject ( Image pObject  )  [virtual]

Removes a pointer to a Image object from the image container.

Parameters:
pObject Pointer to the Image to remove from the image container.
Remarks:
You normally shouldn't have to use this method!! It's mostly used internally by EPOC, but is also available for more advanced cases. Use the Create and Destroy equivalents instead.
See also:
DestroyImage()

void GraphicsManager::AddAnimationObject ( Animation pObject  )  [virtual]

Adds a pointer to a Animation object to the animation container.

Parameters:
pObject Pointer to the Animation to add to the animation container.
Remarks:
You normally shouldn't have to use this method!! It's mostly used internally by EPOC, but is also available for more advanced cases. Use the Create and Destroy equivalents instead.
See also:
CreateAnimation()

void GraphicsManager::RemoveAnimationObject ( Animation pObject  )  [virtual]

Removes a pointer to a Animation object from the animation container.

Parameters:
pObject Pointer to the Animation to remove from the animation container.
Remarks:
You normally shouldn't have to use this method!! It's mostly used internally by EPOC, but is also available for more advanced cases. Use the Create and Destroy equivalents instead.
See also:
DestroyAnimation()

void GraphicsManager::AddTextObject ( Text pObject  )  [virtual]

Adds a pointer to a Text object to the text container.

Parameters:
pObject Pointer to the Animation to add to the animation container.
Remarks:
You normally shouldn't have to use this method!! It's mostly used internally by EPOC, but is also available for more advanced cases. Use the Create and Destroy equivalents instead.
See also:
CreateText()

void GraphicsManager::RemoveTextObject ( Text pObject  )  [virtual]

Removes a pointer to a Text object from the text container.

Parameters:
pObject Pointer to the Text to remove from the text container.
Remarks:
You normally shouldn't have to use this method!! It's mostly used internally by EPOC, but is also available for more advanced cases. Use the Create and Destroy equivalents instead.
See also:
DestroyText()

virtual Image* EPOC::GraphicsManager::CreateImage ( std::string  sFilePath,
bool  bExclusive = false,
bool  bEditable = false 
) [virtual]

Creates an texture from a file, creates an Image object to handle the texture and adds it to the image container and the render container. Textures are by default shared in EPOC which means that EPOC will only create one instance of textures with the same filepath in memory.

Parameters:
sFilePath Path to the file to load
bExclusive Flag telling if the texture of this image texture be exclusivly loaded, if set to true the sharing functionality is ignored and this image get an exclusive texture.
bEditable Flag telling if the texture should be editable (i.e. allow pixel operations). Only important when EPOC is setup to render in OpenGL mode.
Returns:
If creation succeeds a pointer to the created Image is returned, otherwise NULL is returned.
Remarks:
The bExclusive flag is almost a must to set to true if you plan to do pixel operations on the texture. If you do pixel operations on a shared texture, every image that uses that texture is affected.
See also:
CreateImage(Texture *pTexture)

Image * GraphicsManager::CreateImage ( Texture pTexture  )  [virtual]

Creates an Image object to handle the texture supplied and adds it to the image container and the render container.

Returns:
If creation succeeds a pointer to the created Image is returned, otherwise NULL is returned.
See also:
CreateImage()

void GraphicsManager::DestroyImage ( Image pImage  )  [virtual]

Destroys the supplied Image object, removes it from the graphics containers and destroys the texture contained in the image if theres no more references to it.

Parameters:
pImage a pointer to the Image to destroy.
Remarks:
This method is intended for images created by the graphics manager, all other objects will be ignored.

virtual Animation* EPOC::GraphicsManager::CreateAnimation ( std::string  sFilePath,
bool  bExclusive = false,
bool  bEditable = false 
) [virtual]

Creates an texture from a file, creates an Animation object to handle the texture and adds it to the animation container and the render container. Textures are by default shared in EPOC which means that EPOC will only create one instance of textures with the same filepath in memory.

Parameters:
sFilePath Path to the file to load
bExclusive Flag telling if teh texture of this image texture be exclusivly loaded, if set to true the sharing functionality is ignored and this animation get an exclusive texture.
bEditable Flag telling if the texture should be editable (i.e. allow pixel operations). Only important when EPOC is setup to render in OpenGL mode.
Returns:
If creation succeeds a pointer to the created Animation is returned, otherwise NULL is returned.
Remarks:
The bExclusive flag is almost a must to set to true if you plan to do pixel operations on the texture. If you do pixel operations on a shared texture, every image that uses that texture is affected.
See also:
CreateAnimation(Texture *pTexture)

Animation * GraphicsManager::CreateAnimation ( Texture pTexture  )  [virtual]

Creates an Animation object to handle the texture supplied and adds it to the animation container and the render container.

Returns:
If creation succeeds a pointer to the created Animation is returned, otherwise NULL is returned.
See also:
CreateAnimation()

void GraphicsManager::DestroyAnimation ( Animation pAnimation  )  [virtual]

Destroys the supplied Animation object, removes it from the graphics containers and destroys the texture contained in the animation if theres no more references to it

Parameters:
pAnimation a pointer to the Animation to destroy.
Remarks:
This method is intended for animatons created by the graphics manager, all other objects will be ignored.

virtual Text* EPOC::GraphicsManager::CreateText ( std::string  sText,
ColorRGB  rTextColor = ColorRGB(255, 255, 255),
int  nFontSize = DEFAULT_FONT_SIZE,
std::string  sFontPath = DEFAULT_FONT 
) [virtual]

Creates an Text object and adds it to the text container and the render container.

Parameters:
sText The text to display (this can be changed anytime)
pTextColor The color of the text
nFontSize The font size of the text
sFontPath The path to the font to use when rendering the text
Remarks:
Supports TrueType fonts
Returns:
If creation succeeds a pointer to the created Text is returned, otherwise NULL is returned.

void GraphicsManager::DestroyText ( Text pText  )  [virtual]

Destroys the supplied Text object and removes it from the graphics containers.

Parameters:
pText a pointer to the Text to destroy.
Remarks:
This method is intended for animatons created by the graphics manager, all other objects will be ignored.

virtual Texture* EPOC::GraphicsManager::CreateTexture ( std::string  sName,
bool  bExclusive = false,
bool  bEditable = false 
) [virtual]

Creates an empty texture and adds it to the texture container Textures are by default shared in EPOC which means that EPOC will only create one instance of textures with the same filepath in memory.

Parameters:
sName Name to identify the texture.
bExclusive Flag telling if the texture should be exclusive, if set to true the sharing functionality is ignored and this texture is created as an exclusive texture.
bEditable Flag telling if the texture should be editable (i.e. allow pixel operations). Only important when EPOC is setup to render in OpenGL mode.
Returns:
If creation succeeds a pointer to the created Texture is returned, otherwise NULL is returned.
Remarks:
The bExclusive flag is almost a must to set to true if you plan to do pixel operations on the texture. If you do pixel operations on a shared texture, every object refering to the texture is affected.
See also:
LoadTextureFromFile()

GetTexture()

bool GraphicsManager::DestroyTexture ( Texture pTexture  )  [virtual]

Destroys the supplied Texture object, removes it from the graphics containers and destroys the texture if theres no more references to it

Parameters:
pTexture a pointer to the Texture to destroy.
Remarks:
This method is intended for textures created by the graphics manager, all other objects will be ignored.

virtual Texture* EPOC::GraphicsManager::LoadTextureFromFile ( std::string  sFilePath,
bool  bExclusive = false,
bool  bEditable = false 
) [virtual]

Loads a texture from file

Parameters:
sFilePath Filepath to the texture.
bExclusive Flag telling if the texture should be exclusive, if set to true the sharing functionality is ignored and this texture is created as an exclusive texture.
bEditable Flag telling if the texture should be editable (i.e. allow pixel operations). Only important when EPOC is setup to render in OpenGL mode.
Returns:
If creation succeeds a pointer to the created Texture is returned, otherwise NULL is returned.
Remarks:
The bExclusive flag is almost a must to set to true if you plan to do pixel operations on the texture. If you do pixel operations on a shared texture, every object refering to the texture is affected.

This method is used internally by CreateTexture(..) and should only be used if you know what you are doing.

Supports the following formats: BMP, GIF, JPEG, LBM, PCX, PNG, PNM, TGA, TIFF, XCF, XPM, XV

See also:
CreateTexture()

GetTexture()

virtual Texture* EPOC::GraphicsManager::GetTexture ( std::string  sName  )  [virtual]

Returns a pointer to an Texture, from the graphics resources, using the name of the texture

Parameters:
sName Name to identify the texture
Returns:
If the texture exists in the resources a pointer to it is returned, otherwise NULL is returned.
Remarks:
This method is used internally by CreateTexture(..) and should only be used if you know what you are doing.
See also:
CreateTexture()

LoadTextureFromFile()

void GraphicsManager::AddTexture ( Texture pTexture  )  [virtual]

Adds a texture to the graphics resources

Parameters:
pTexture 
Returns:
If the texture exists in the resources a pointer to it is returned, otherwise NULL is returned.
Remarks:
This method is used internally by CreateTexture(..) and should only be used if you know what you are doing.
See also:
CreateTexture()

LoadTextureFromFile()

GetTexture()

bool GraphicsManager::RemoveTexture ( Texture pTexture  )  [virtual]

Removes a texture from the graphics resources

Parameters:
pTexture 
Returns:
True if the texture exists in the resources and was successfully removed, otherwise false is returned.
Remarks:
This method is used internally by DestroyTexture(..) and should only be used if you know what you are doing.
See also:
DestroyTexture()

LoadTextureFromFile()

AddTexture()

void GraphicsManager::SetRenderSorting ( bool  bStatus  )  [virtual]

Sets a flag telling if the graphics manager should sort the rendercontainer before rendering or not.

Parameters:
bStatus If set to true the render container will be sorted before rendering, if set to false it will be rendered as it is.

void GraphicsManager::SetClearColor ( ColorRGB  rColor  )  [virtual]

Sets a flag telling if the graphics manager sould sort the rendercontainer before rendering or not.

Parameters:
bStatus If set to true the render container will be sorted before rendering, if set to false it will be rendered as it is.

bool EPOC::GraphicsManager::IsDebugInfoEnabled (  )  [inline]

void EPOC::GraphicsManager::SetDebugInfo ( bool  bStatus  )  [inline]

bool EPOC::GraphicsManager::IsRenderSortingEnabled (  )  [inline]

bool GraphicsManager::InitializeOpenGL (  )  [protected, virtual]

void GraphicsManager::RenderSDL ( TextureSDL pDestSurface  )  [protected, virtual]

void GraphicsManager::RenderOGL ( TextureSDL pDestSurface  )  [protected, virtual]

bool GraphicsManager::UpdateDebugInformation ( float  fTimeDelta  )  [protected, virtual]

virtual void EPOC::GraphicsManager::SortRenderContainer ( std::vector< class GraphicsObject * > *  pRenderContainer  )  [protected, virtual]

virtual void EPOC::GraphicsManager::SortAlphaRenderContainer ( std::vector< class GraphicsObject * > *  pRenderContainer  )  [protected, virtual]

int GraphicsManager::ZOrderGreater ( GraphicsObject pObject1,
class GraphicsObject pObject2 
) [static, protected]

int GraphicsManager::ZOrderSmaller ( GraphicsObject pObject1,
class GraphicsObject pObject2 
) [static, protected]


Member Data Documentation

int EPOC::GraphicsManager::m_nFrameCounter [protected]

int EPOC::GraphicsManager::m_nRenderCandidates [protected]

int EPOC::GraphicsManager::m_nRenderedObjects [protected]

bool EPOC::GraphicsManager::m_bShowDebugInfo [protected]

bool EPOC::GraphicsManager::m_bSortRenderContainer [protected]

Text* EPOC::GraphicsManager::m_pDebugText [protected]

ColorRGB EPOC::GraphicsManager::m_rClearColor [protected]

std::list<GraphicsObject*> EPOC::GraphicsManager::m_rImages [protected]

std::list<GraphicsObject*> EPOC::GraphicsManager::m_rAnimations [protected]

std::list<GraphicsObject*> EPOC::GraphicsManager::m_rTexts [protected]

std::list<std::list<GraphicsObject*> *> EPOC::GraphicsManager::m_rUpdateContainer [protected]

std::vector<GraphicsObject*> EPOC::GraphicsManager::m_rRenderContainer [protected]

std::vector<GraphicsObject*> EPOC::GraphicsManager::m_rAlphaRenderContainer [protected]

std::list<Texture*> EPOC::GraphicsManager::m_rTextures [protected]

Application* EPOC::GraphicsManager::m_pApplication [protected]


The documentation for this class was generated from the following files:
Generated on Tue Feb 12 08:26:04 2008 for EPOC by  doxygen 1.5.4