FIFE  6e1afdbeda11afe9ac53e6023a4be96ef88f1dc6
FIFE::CellSelectionRenderer Class Reference

CellSelectionRenderer renders a frame around selected cells. More...

#include <cellselectionrenderer.h>

+ Inheritance diagram for FIFE::CellSelectionRenderer:
+ Collaboration diagram for FIFE::CellSelectionRenderer:

Public Member Functions

 CellSelectionRenderer (RenderBackend *renderbackend, int32_t position)
 Constructor. More...
 
 CellSelectionRenderer (const CellSelectionRenderer &old)
 Copy Constructor. More...
 
RendererBaseclone ()
 Makes copy of this renderer. More...
 
virtual ~CellSelectionRenderer ()
 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 reset ()
 Deselects all locations. More...
 
void selectLocation (const Location *loc)
 Selects given location on map. More...
 
void deselectLocation (const Location *loc)
 Deselects given location on map. More...
 
const std::vector< LocationgetLocations () const
 Returns selected locations. More...
 
void setColor (uint8_t r, uint8_t g, uint8_t b)
 Changes the used color. 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 CellSelectionRenderergetInstance (IRendererContainer *cnt)
 Gets instance for interface access. More...
 

Private Attributes

std::vector< Locationm_locations
 selected locations More...
 
SDL_Color m_color
 currently used color 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

CellSelectionRenderer renders a frame around selected cells.

Definition at line 41 of file cellselectionrenderer.h.

Constructor & Destructor Documentation

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

Constructor.

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

Definition at line 48 of file cellselectionrenderer.cpp.

References m_color, and FIFE::RendererBase::setEnabled().

Referenced by clone().

+ Here is the caller graph for this function:

FIFE::CellSelectionRenderer::CellSelectionRenderer ( const CellSelectionRenderer old)

Copy Constructor.

Definition at line 56 of file cellselectionrenderer.cpp.

References FIFE::RendererBase::setEnabled().

FIFE::CellSelectionRenderer::~CellSelectionRenderer ( )
virtual

Destructor.

Definition at line 66 of file cellselectionrenderer.cpp.

Member Function Documentation

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

Makes copy of this renderer.

Implements FIFE::RendererBase.

Definition at line 62 of file cellselectionrenderer.cpp.

References CellSelectionRenderer().

void FIFE::CellSelectionRenderer::deselectLocation ( const Location loc)

Deselects given location on map.

Parameters
locThe location.

Definition at line 90 of file cellselectionrenderer.cpp.

References FIFE::Location::getLayerCoordinates(), and m_locations.

Referenced by getName().

+ Here is the caller graph for this function:

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

Gets instance for interface access.

Definition at line 69 of file cellselectionrenderer.cpp.

References FIFE::IRendererContainer::getRenderer().

Referenced by getName().

+ Here is the caller graph for this function:

const std::vector<Location> FIFE::CellSelectionRenderer::getLocations ( ) const
inline

Returns selected locations.

Returns
A vector that contains all selected locations.

Definition at line 102 of file cellselectionrenderer.h.

References m_locations, and setColor().

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

Returns the renderer name.

Returns
The name as string.

Implements FIFE::RendererBase.

Definition at line 76 of file cellselectionrenderer.h.

References deselectLocation(), getInstance(), reset(), and selectLocation().

void FIFE::CellSelectionRenderer::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 102 of file cellselectionrenderer.cpp.

References FIFE::_log, FIFE::RenderBackend::drawLine(), FL_WARN, FIFE::Layer::getCellGrid(), FIFE::Location::getLayer(), FIFE::Location::getLayerCoordinates(), FIFE::CellGrid::getVertices(), m_color, m_locations, FIFE::RendererBase::m_renderbackend, FIFE::CellGrid::toMapCoordinates(), FIFE::Camera::toScreenCoordinates(), FIFE::PointType2D< T >::x, FIFE::PointType3D< T >::x, FIFE::PointType2D< T >::y, and FIFE::PointType3D< T >::y.

void FIFE::CellSelectionRenderer::reset ( )
virtual

Deselects all locations.

Reimplemented from FIFE::RendererBase.

Definition at line 73 of file cellselectionrenderer.cpp.

References m_locations.

Referenced by getName().

+ Here is the caller graph for this function:

void FIFE::CellSelectionRenderer::selectLocation ( const Location loc)

Selects given location on map.

Parameters
locThe location.

Definition at line 77 of file cellselectionrenderer.cpp.

References FIFE::Location::getLayerCoordinates(), and m_locations.

Referenced by getName().

+ Here is the caller graph for this function:

void FIFE::CellSelectionRenderer::setColor ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)

Changes the used color.

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 139 of file cellselectionrenderer.cpp.

References m_color.

Referenced by getLocations().

+ Here is the caller graph for this function:

Member Data Documentation

SDL_Color FIFE::CellSelectionRenderer::m_color
private

currently used color

Definition at line 117 of file cellselectionrenderer.h.

Referenced by CellSelectionRenderer(), render(), and setColor().

std::vector<Location> FIFE::CellSelectionRenderer::m_locations
private

selected locations

Definition at line 114 of file cellselectionrenderer.h.

Referenced by deselectLocation(), getLocations(), render(), reset(), and selectLocation().


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