FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
FIFE::GridRenderer Class Reference

#include <gridrenderer.h>

+ Inheritance diagram for FIFE::GridRenderer:
+ Collaboration diagram for FIFE::GridRenderer:

Public Member Functions

 GridRenderer (RenderBackend *renderbackend, int32_t position)
 constructor. More...
 
 GridRenderer (const GridRenderer &old)
 
RendererBaseclone ()
 Makes copy of this renderer. More...
 
virtual ~GridRenderer ()
 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 ()
 Name of the renderer. More...
 
void setColor (Uint8 r, Uint8 g, Uint8 b)
 
- 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 GridRenderergetInstance (IRendererContainer *cnt)
 

Private Attributes

SDL_Color m_color
 

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 38 of file gridrenderer.h.

Constructor & Destructor Documentation

◆ GridRenderer() [1/2]

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

constructor.

Parameters
renderbackendto use
positionposition for this renderer in rendering pipeline

Definition at line 48 of file gridrenderer.cpp.

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

Referenced by clone().

+ Here is the caller graph for this function:

◆ GridRenderer() [2/2]

FIFE::GridRenderer::GridRenderer ( const GridRenderer old)

Definition at line 56 of file gridrenderer.cpp.

References FIFE::RendererBase::setEnabled().

◆ ~GridRenderer()

FIFE::GridRenderer::~GridRenderer ( )
virtual

Destructor.

Definition at line 66 of file gridrenderer.cpp.

Member Function Documentation

◆ clone()

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

Makes copy of this renderer.

Implements FIFE::RendererBase.

Definition at line 62 of file gridrenderer.cpp.

References GridRenderer().

◆ getInstance()

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

Definition at line 69 of file gridrenderer.cpp.

References FIFE::IRendererContainer::getRenderer().

Referenced by getName().

+ Here is the caller graph for this function:

◆ getName()

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

Name of the renderer.

Implements FIFE::RendererBase.

Definition at line 55 of file gridrenderer.h.

References getInstance(), and setColor().

◆ render()

void FIFE::GridRenderer::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.

Renderers receive non-clipped instance stack since there is no way to know which information is relevant for the renderer. E.g. effect renderer might need to know offscreen instance locations to be able to draw radiation coming from some instance not visible on the screen.

Parameters
camcamera view to draw
layercurrent layer to be rendered
instancesinstances on the current layer @ see setPipelinePosition

Implements FIFE::RendererBase.

Definition at line 73 of file gridrenderer.cpp.

References FIFE::_log, FIFE::RenderBackend::drawLine(), FL_WARN, FIFE::Layer::getCellGrid(), FIFE::Location::getLayerCoordinates(), FIFE::Instance::getLocationRef(), FIFE::CellGrid::getVertices(), FIFE::Camera::getViewPort(), FIFE::RectType< T >::h, m_color, FIFE::RendererBase::m_renderbackend, FIFE::CellGrid::toMapCoordinates(), FIFE::Camera::toScreenCoordinates(), FIFE::RectType< T >::w, FIFE::PointType2D< T >::x, FIFE::RectType< T >::x, FIFE::PointType3D< T >::x, FIFE::PointType2D< T >::y, FIFE::RectType< T >::y, and FIFE::PointType3D< T >::y.

◆ setColor()

void FIFE::GridRenderer::setColor ( Uint8  r,
Uint8  g,
Uint8  b 
)

Definition at line 191 of file gridrenderer.cpp.

References m_color.

Referenced by getName().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_color

SDL_Color FIFE::GridRenderer::m_color
private

Definition at line 61 of file gridrenderer.h.

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


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