#include <GraphicsManager.h>
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 Image * | CreateImage (std::string sFilePath, bool bExclusive=false, bool bEditable=false) |
virtual Image * | CreateImage (Texture *pTexture) |
virtual void | DestroyImage (Image *pImage) |
virtual Animation * | CreateAnimation (std::string sFilePath, bool bExclusive=false, bool bEditable=false) |
virtual Animation * | CreateAnimation (Texture *pTexture) |
virtual void | DestroyAnimation (Animation *pAnimation) |
virtual Text * | CreateText (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 Texture * | CreateTexture (std::string sName, bool bExclusive=false, bool bEditable=false) |
virtual bool | DestroyTexture (Texture *pTexture) |
virtual Texture * | LoadTextureFromFile (std::string sFilePath, bool bExclusive=false, bool bEditable=false) |
virtual Texture * | GetTexture (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 |
Text * | m_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 |
Application * | m_pApplication |
GraphicsManager::GraphicsManager | ( | Application * | pApplication | ) |
Contructor Resets all members to the default values
void GraphicsManager::Cleanup | ( | ) | [virtual] |
Cleans up any relevant data
bool GraphicsManager::Initialize | ( | ) | [virtual] |
Initializes any relevant data
bool GraphicsManager::Update | ( | float | fTimeDelta | ) | [virtual] |
Updates the animation
fTimeDelta | the time that has passed since last update, measured in milliseconds |
Reimplemented from EPOC::BaseObject.
void GraphicsManager::Render | ( | TextureSDL * | pDestSurface | ) | [virtual] |
Renders all graphical content created by this manager
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.
pObject | Pointer to the GraphicsObject to add to the render container. |
void GraphicsManager::AddImageObject | ( | Image * | pObject | ) | [virtual] |
Adds a pointer to a Image object to the image container.
pObject | Pointer to the Image to add to the image container. |
void GraphicsManager::RemoveImageObject | ( | Image * | pObject | ) | [virtual] |
Removes a pointer to a Image object from the image container.
pObject | Pointer to the Image to remove from the image container. |
void GraphicsManager::AddAnimationObject | ( | Animation * | pObject | ) | [virtual] |
Adds a pointer to a Animation object to the animation container.
pObject | Pointer to the Animation to add to the animation container. |
void GraphicsManager::RemoveAnimationObject | ( | Animation * | pObject | ) | [virtual] |
Removes a pointer to a Animation object from the animation container.
pObject | Pointer to the Animation to remove from the animation container. |
void GraphicsManager::AddTextObject | ( | Text * | pObject | ) | [virtual] |
Adds a pointer to a Text object to the text container.
pObject | Pointer to the Animation to add to the animation container. |
void GraphicsManager::RemoveTextObject | ( | Text * | pObject | ) | [virtual] |
Removes a pointer to a Text object from the text container.
pObject | Pointer to the Text to remove from the text container. |
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.
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. |
Creates an Image object to handle the texture supplied and adds it to the image container and the render container.
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.
pImage | a pointer to the Image to destroy. |
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.
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. |
Creates an Animation object to handle the texture supplied and adds it to the animation container and the render container.
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
pAnimation | a pointer to the Animation to destroy. |
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.
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 |
void GraphicsManager::DestroyText | ( | Text * | pText | ) | [virtual] |
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.
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. |
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
pTexture | a pointer to the Texture to destroy. |
virtual Texture* EPOC::GraphicsManager::LoadTextureFromFile | ( | std::string | sFilePath, | |
bool | bExclusive = false , |
|||
bool | bEditable = false | |||
) | [virtual] |
Loads a texture from file
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. |
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
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
sName | Name to identify the texture |
void GraphicsManager::AddTexture | ( | Texture * | pTexture | ) | [virtual] |
Adds a texture to the graphics resources
pTexture |
bool GraphicsManager::RemoveTexture | ( | Texture * | pTexture | ) | [virtual] |
Removes a texture from the graphics resources
pTexture |
void GraphicsManager::SetRenderSorting | ( | bool | bStatus | ) | [virtual] |
Sets a flag telling if the graphics manager should sort the rendercontainer before rendering or not.
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.
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] |
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] |