FIFE  6e1afdbeda11afe9ac53e6023a4be96ef88f1dc6
FIFE::GenericRenderer Class Reference

#include <genericrenderer.h>

+ Inheritance diagram for FIFE::GenericRenderer:
+ Collaboration diagram for FIFE::GenericRenderer:

Public Member Functions

 GenericRenderer (RenderBackend *renderbackend, int32_t position)
 Constructor. More...
 
 GenericRenderer (const GenericRenderer &old)
 Copy Constructor. More...
 
RendererBaseclone ()
 Makes copy of this renderer. More...
 
virtual ~GenericRenderer ()
 Destructor. More...
 
void render (Camera *cam, Layer *layer, RenderList &instances)
 This method is called by the view to ask renderer to draw its rendering aspect based on given parameters. More...
 
std::string getName ()
 Returns the renderer name. More...
 
void addLine (const std::string &group, RendererNode n1, RendererNode n2, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
 Adds a line. More...
 
void addPoint (const std::string &group, RendererNode n, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
 Adds a point. More...
 
void addTriangle (const std::string &group, RendererNode n1, RendererNode n2, RendererNode n3, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
 Adds a triangle. More...
 
void addQuad (const std::string &group, RendererNode n1, RendererNode n2, RendererNode n3, RendererNode n4, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
 Adds a quad. More...
 
void addVertex (const std::string &group, RendererNode n, int32_t size, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
 Adds a vertex. More...
 
void addText (const std::string &group, RendererNode n, IFont *font, const std::string &text, bool zoomed=true)
 Adds text. More...
 
void addImage (const std::string &group, RendererNode n, ImagePtr image, bool zoomed=true)
 Adds an image. More...
 
void addAnimation (const std::string &group, RendererNode n, AnimationPtr animation, bool zoomed=true)
 Adds an animation. More...
 
void resizeImage (const std::string &group, RendererNode n, ImagePtr image, int32_t width, int32_t height, bool zoomed=true)
 Adds an image with another size. More...
 
void removeAll (const std::string &group)
 Removes all elements of a group. More...
 
void removeAll ()
 Removes all elements. More...
 
void reset ()
 Resets the renderer. More...
 
- Public Member Functions inherited from FIFE::RendererBase
 RendererBase (RenderBackend *renderbackend, int32_t position)
 Constructor. More...
 
 RendererBase (const RendererBase &old)
 Copy Constructor. More...
 
virtual ~RendererBase ()
 Destructor. More...
 
int32_t getPipelinePosition () const
 Gets renderer position in the rendering pipeline. More...
 
void setPipelinePosition (int32_t position)
 Sets renderer position in the rendering pipeline Pipeline position defines in which order view calls the renderers when update occurs Note that renderers are called once per rendered layer, thus to update the whole screen, renderer might receive multiple calls. More...
 
virtual void setEnabled (bool enabled)
 Enables renderer. More...
 
bool isEnabled () const
 Is renderer enabled. More...
 
void setRendererListener (IRendererListener *listener)
 Sets listener for renderer. More...
 
void addActiveLayer (Layer *layer)
 Adds active layer to renderer. More...
 
void removeActiveLayer (Layer *layer)
 Removes active layer from renderer. More...
 
void clearActiveLayers ()
 Clears all active layers from renderer. More...
 
void activateAllLayers (Map *elevation)
 Activates all layers from given elevation. More...
 
bool isActivedLayer (Layer *layer)
 Returns if given layer is currently activated. More...
 
std::list< Layer * > getActiveLayers () const
 Returns list of activated layer. More...
 

Static Public Member Functions

static GenericRenderergetInstance (IRendererContainer *cnt)
 Gets instance for interface access. More...
 

Private Attributes

std::map< std::string, std::vector< GenericRendererElementInfo * > > m_groups
 A map that holds the groups together with the appended render elements. More...
 

Additional Inherited Members

- Protected Member Functions inherited from FIFE::RendererBase
 RendererBase ()
 
- Protected Attributes inherited from FIFE::RendererBase
std::list< Layer * > m_active_layers
 
RenderBackendm_renderbackend
 

Detailed Description

Definition at line 161 of file genericrenderer.h.

Constructor & Destructor Documentation

FIFE::GenericRenderer::GenericRenderer ( RenderBackend renderbackend,
int32_t  position 
)

Constructor.

Parameters
renderbackendThe renderbackend to use.
positionThe position for this renderer in rendering pipeline. @ see setPipelinePosition

Definition at line 289 of file genericrenderer.cpp.

References FIFE::RendererBase::setEnabled().

Referenced by clone().

+ Here is the caller graph for this function:

FIFE::GenericRenderer::GenericRenderer ( const GenericRenderer old)

Copy Constructor.

Definition at line 295 of file genericrenderer.cpp.

References FIFE::RendererBase::setEnabled().

FIFE::GenericRenderer::~GenericRenderer ( )
virtual

Destructor.

Definition at line 305 of file genericrenderer.cpp.

Member Function Documentation

void FIFE::GenericRenderer::addAnimation ( const std::string &  group,
RendererNode  n,
AnimationPtr  animation,
bool  zoomed = true 
)

Adds an animation.

Parameters
groupThe group name as string.
nA RendererNode, contains the coordinates.
animationThe used animation.
zoomedA flag that indicates whether the camera zoom to be used. Default is true.

Definition at line 335 of file genericrenderer.cpp.

References m_groups.

void FIFE::GenericRenderer::addImage ( const std::string &  group,
RendererNode  n,
ImagePtr  image,
bool  zoomed = true 
)

Adds an image.

Parameters
groupThe group name as string.
nA RendererNode, contains the coordinates.
imageThe used image.
zoomedA flag that indicates whether the camera zoom to be used. Default is true.

Definition at line 331 of file genericrenderer.cpp.

References m_groups.

void FIFE::GenericRenderer::addLine ( const std::string &  group,
RendererNode  n1,
RendererNode  n2,
uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255 
)

Adds a line.

Parameters
groupThe group name as string.
n1A RendererNode, contains the coordinates.
n2A RendererNode, contains the coordinates.
rThe value for red, range 0-255.
gThe value for green, range 0-255.
bThe value for blue, range 0-255.
aThe value for alpha, range 0-255. Default value is 255, full opaque.

Definition at line 307 of file genericrenderer.cpp.

References m_groups.

void FIFE::GenericRenderer::addPoint ( const std::string &  group,
RendererNode  n,
uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255 
)

Adds a point.

Parameters
groupThe group name as string.
nA RendererNode, contains the coordinates.
rThe value for red, range 0-255.
gThe value for green, range 0-255.
bThe value for blue, range 0-255.
aThe value for alpha, range 0-255. Default value is 255, full opaque.

Definition at line 311 of file genericrenderer.cpp.

References m_groups.

void FIFE::GenericRenderer::addQuad ( const std::string &  group,
RendererNode  n1,
RendererNode  n2,
RendererNode  n3,
RendererNode  n4,
uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255 
)

Adds a quad.

Parameters
groupThe group name as string.
n1A RendererNode, contains the coordinates.
n2A RendererNode, contains the coordinates.
n3A RendererNode, contains the coordinates.
n4A RendererNode, contains the coordinates.
rThe value for red, range 0-255.
gThe value for green, range 0-255.
bThe value for blue, range 0-255.
aThe value for alpha, range 0-255. Default value is 255, full opaque.

Definition at line 319 of file genericrenderer.cpp.

References m_groups.

void FIFE::GenericRenderer::addText ( const std::string &  group,
RendererNode  n,
IFont font,
const std::string &  text,
bool  zoomed = true 
)

Adds text.

Parameters
groupThe group name as string.
nA RendererNode, contains the coordinates.
fontThe used font.
textThe text as string.
zoomedA flag that indicates whether the camera zoom to be used. Default is true.

Definition at line 327 of file genericrenderer.cpp.

References m_groups.

void FIFE::GenericRenderer::addTriangle ( const std::string &  group,
RendererNode  n1,
RendererNode  n2,
RendererNode  n3,
uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255 
)

Adds a triangle.

Parameters
groupThe group name as string.
n1A RendererNode, contains the coordinates.
n2A RendererNode, contains the coordinates.
n3A RendererNode, contains the coordinates.
rThe value for red, range 0-255.
gThe value for green, range 0-255.
bThe value for blue, range 0-255.
aThe value for alpha, range 0-255. Default value is 255, full opaque.

Definition at line 315 of file genericrenderer.cpp.

References m_groups.

void FIFE::GenericRenderer::addVertex ( const std::string &  group,
RendererNode  n,
int32_t  size,
uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255 
)

Adds a vertex.

Parameters
groupThe group name as string.
nA RendererNode, contains the coordinates.
sizeThe size of the vertex.
rThe value for red, range 0-255.
gThe value for green, range 0-255.
bThe value for blue, range 0-255.
aThe value for alpha, range 0-255. Default value is 255, full opaque.

Definition at line 323 of file genericrenderer.cpp.

References m_groups.

RendererBase * FIFE::GenericRenderer::clone ( )
virtual

Makes copy of this renderer.

Implements FIFE::RendererBase.

Definition at line 301 of file genericrenderer.cpp.

References GenericRenderer().

GenericRenderer * FIFE::GenericRenderer::getInstance ( IRendererContainer cnt)
static

Gets instance for interface access.

Definition at line 285 of file genericrenderer.cpp.

References FIFE::IRendererContainer::getRenderer().

std::string FIFE::GenericRenderer::getName ( )
inlinevirtual

Returns the renderer name.

Returns
The name as string.

Implements FIFE::RendererBase.

Definition at line 196 of file genericrenderer.h.

void FIFE::GenericRenderer::removeAll ( const std::string &  group)

Removes all elements of a group.

Parameters
groupThe group name as string.

Definition at line 343 of file genericrenderer.cpp.

References m_groups.

void FIFE::GenericRenderer::removeAll ( )

Removes all elements.

Definition at line 352 of file genericrenderer.cpp.

References m_groups.

Referenced by reset().

+ Here is the caller graph for this function:

void FIFE::GenericRenderer::render ( Camera cam,
Layer layer,
RenderList instances 
)
virtual

This method is called by the view to ask renderer to draw its rendering aspect based on given parameters.

Parameters
camCamera view to draw
layerCurrent layer to be rendered
instancesInstances on the current layer

Implements FIFE::RendererBase.

Definition at line 367 of file genericrenderer.cpp.

References m_groups, and FIFE::RendererBase::m_renderbackend.

void FIFE::GenericRenderer::reset ( )
virtual

Resets the renderer.

Reimplemented from FIFE::RendererBase.

Definition at line 363 of file genericrenderer.cpp.

References removeAll().

void FIFE::GenericRenderer::resizeImage ( const std::string &  group,
RendererNode  n,
ImagePtr  image,
int32_t  width,
int32_t  height,
bool  zoomed = true 
)

Adds an image with another size.

Parameters
groupThe group name as string.
nA RendererNode, contains the coordinates.
imageThe used image.
widthNew width of the image.
heightNew height of the image.
zoomedA flag that indicates whether the camera zoom to be used. Default is true.

Definition at line 339 of file genericrenderer.cpp.

References m_groups.

Member Data Documentation

std::map<std::string, std::vector<GenericRendererElementInfo*> > FIFE::GenericRenderer::m_groups
private

A map that holds the groups together with the appended render elements.

Definition at line 319 of file genericrenderer.h.

Referenced by addAnimation(), addImage(), addLine(), addPoint(), addQuad(), addText(), addTriangle(), addVertex(), removeAll(), render(), and resizeImage().


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