FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
FIFE::CellRenderer Class Reference

#include <cellrenderer.h>

+ Inheritance diagram for FIFE::CellRenderer:
+ Collaboration diagram for FIFE::CellRenderer:

Public Member Functions

 CellRenderer (RenderBackend *renderbackend, int32_t position)
 Constructor. More...
 
 CellRenderer (const CellRenderer &old)
 Copy Constructor. More...
 
RendererBaseclone ()
 Makes copy of this renderer. More...
 
virtual ~CellRenderer ()
 Destructor. More...
 
std::string getName ()
 Returns the renderer name. 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...
 
void setBlockerColor (uint8_t r, uint8_t g, uint8_t b)
 Sets color that is used to visualize blocker. More...
 
void setPathColor (uint8_t r, uint8_t g, uint8_t b)
 Sets color that is used to visualize paths. More...
 
void setEnabledBlocking (bool enabled)
 Enables blocking visualization. More...
 
bool isEnabledBlocking ()
 Gets whether blocking visualization is enabled. More...
 
void setEnabledPathVisual (bool enabled)
 Enables path visualization. More...
 
bool isEnabledPathVisual ()
 Gets whether path visualization is enabled. More...
 
void addPathVisual (Instance *instance)
 Adds a instance to path visualization. More...
 
void removePathVisual (Instance *instance)
 Removes a instance from path visualization. More...
 
void setEnabledCost (const std::string &costId, bool enabled)
 Enables cost visualization. More...
 
bool isEnabledCost (const std::string &costId)
 Gets whether a cost visualization is enabled. More...
 
void setFont (IFont *font)
 Sets the font. More...
 
IFontgetFont ()
 Returns the font. 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...
 
virtual void reset ()
 Resets information in the 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 CellRenderergetInstance (IRendererContainer *cnt)
 Gets instance for interface access. More...
 

Private Attributes

SDL_Color m_blockerColor
 
SDL_Color m_pathColor
 
bool m_blockingEnabled
 
bool m_pathVisualEnabled
 
IFontm_font
 
std::vector< Instance * > m_visualPaths
 
std::set< std::string > m_visualCosts
 

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 42 of file cellrenderer.h.

Constructor & Destructor Documentation

◆ CellRenderer() [1/2]

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

Constructor.

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

Definition at line 51 of file cellrenderer.cpp.

References m_blockerColor, m_blockingEnabled, m_font, m_pathColor, m_pathVisualEnabled, and FIFE::RendererBase::setEnabled().

Referenced by clone().

+ Here is the caller graph for this function:

◆ CellRenderer() [2/2]

FIFE::CellRenderer::CellRenderer ( const CellRenderer old)

Copy Constructor.

Definition at line 66 of file cellrenderer.cpp.

References m_blockingEnabled, m_font, m_pathVisualEnabled, and FIFE::RendererBase::setEnabled().

◆ ~CellRenderer()

FIFE::CellRenderer::~CellRenderer ( )
virtual

Destructor.

Definition at line 80 of file cellrenderer.cpp.

Member Function Documentation

◆ addPathVisual()

void FIFE::CellRenderer::addPathVisual ( Instance instance)

Adds a instance to path visualization.

The current path is automatically rendered.

Parameters
instanceThe instance's path is visualized.

Definition at line 253 of file cellrenderer.cpp.

References m_visualPaths.

◆ clone()

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

Makes copy of this renderer.

Implements FIFE::RendererBase.

Definition at line 76 of file cellrenderer.cpp.

References CellRenderer().

◆ getFont()

IFont * FIFE::CellRenderer::getFont ( )

Returns the font.

Returns
The used font.

Definition at line 249 of file cellrenderer.cpp.

References m_font.

◆ getInstance()

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

Gets instance for interface access.

Definition at line 83 of file cellrenderer.cpp.

References FIFE::IRendererContainer::getRenderer().

◆ getName()

std::string FIFE::CellRenderer::getName ( )
virtual

Returns the renderer name.

Returns
The name as string.

Implements FIFE::RendererBase.

Definition at line 87 of file cellrenderer.cpp.

◆ isEnabledBlocking()

bool FIFE::CellRenderer::isEnabledBlocking ( )

Gets whether blocking visualization is enabled.

Returns
A bool, true if visualization is enabled, otherwise false.

Definition at line 233 of file cellrenderer.cpp.

References m_blockingEnabled.

◆ isEnabledCost()

bool FIFE::CellRenderer::isEnabledCost ( const std::string &  costId)

Gets whether a cost visualization is enabled.

Parameters
costIdThe cost identifier as string.
Returns
A bool, true if visualization is enabled, otherwise false.

Definition at line 276 of file cellrenderer.cpp.

References m_visualCosts.

◆ isEnabledPathVisual()

bool FIFE::CellRenderer::isEnabledPathVisual ( )

Gets whether path visualization is enabled.

Returns
A bool, true if visualization is enabled, otherwise false.

Definition at line 241 of file cellrenderer.cpp.

References m_pathVisualEnabled.

◆ removePathVisual()

void FIFE::CellRenderer::removePathVisual ( Instance instance)

Removes a instance from path visualization.

Parameters
instanceThe instance's path is visualized.

Definition at line 257 of file cellrenderer.cpp.

References m_visualPaths.

◆ render()

◆ setBlockerColor()

void FIFE::CellRenderer::setBlockerColor ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)

Sets color that is used to visualize blocker.

Parameters
rThe value for red, range 0-255.
gThe value for green, range 0-255.
bThe value for blue, range 0-255.

Definition at line 217 of file cellrenderer.cpp.

References m_blockerColor.

◆ setEnabledBlocking()

void FIFE::CellRenderer::setEnabledBlocking ( bool  enabled)

Enables blocking visualization.

Parameters
enabledA bool that enables or disables the visualization.

Definition at line 229 of file cellrenderer.cpp.

References m_blockingEnabled.

◆ setEnabledCost()

void FIFE::CellRenderer::setEnabledCost ( const std::string &  costId,
bool  enabled 
)

Enables cost visualization.

Parameters
costIdThe cost identifier as string.
enabledA bool that enables or disables the visualization.

Definition at line 268 of file cellrenderer.cpp.

References m_visualCosts.

◆ setEnabledPathVisual()

void FIFE::CellRenderer::setEnabledPathVisual ( bool  enabled)

Enables path visualization.

Parameters
enabledA bool that enables or disables the visualization.

Definition at line 237 of file cellrenderer.cpp.

References m_pathVisualEnabled.

◆ setFont()

void FIFE::CellRenderer::setFont ( IFont font)

Sets the font.

Parameters
fontThe used font.

Definition at line 245 of file cellrenderer.cpp.

References m_font.

◆ setPathColor()

void FIFE::CellRenderer::setPathColor ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)

Sets color that is used to visualize paths.

Parameters
rThe value for red, range 0-255.
gThe value for green, range 0-255.
bThe value for blue, range 0-255.

Definition at line 223 of file cellrenderer.cpp.

References m_pathColor.

Member Data Documentation

◆ m_blockerColor

SDL_Color FIFE::CellRenderer::m_blockerColor
private

Definition at line 162 of file cellrenderer.h.

Referenced by CellRenderer(), render(), and setBlockerColor().

◆ m_blockingEnabled

bool FIFE::CellRenderer::m_blockingEnabled
private

Definition at line 164 of file cellrenderer.h.

Referenced by CellRenderer(), isEnabledBlocking(), render(), and setEnabledBlocking().

◆ m_font

IFont* FIFE::CellRenderer::m_font
private

Definition at line 166 of file cellrenderer.h.

Referenced by CellRenderer(), getFont(), render(), and setFont().

◆ m_pathColor

SDL_Color FIFE::CellRenderer::m_pathColor
private

Definition at line 163 of file cellrenderer.h.

Referenced by CellRenderer(), render(), and setPathColor().

◆ m_pathVisualEnabled

bool FIFE::CellRenderer::m_pathVisualEnabled
private

Definition at line 165 of file cellrenderer.h.

Referenced by CellRenderer(), isEnabledPathVisual(), render(), and setEnabledPathVisual().

◆ m_visualCosts

std::set<std::string> FIFE::CellRenderer::m_visualCosts
private

Definition at line 169 of file cellrenderer.h.

Referenced by isEnabledCost(), render(), and setEnabledCost().

◆ m_visualPaths

std::vector<Instance*> FIFE::CellRenderer::m_visualPaths
private

Definition at line 168 of file cellrenderer.h.

Referenced by addPathVisual(), removePathVisual(), and render().


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