FIFE
be64c707dea6b3250bd4355bf5c825d25920087d
|
#include <cellrenderer.h>
Public Member Functions | |
CellRenderer (RenderBackend *renderbackend, int32_t position) | |
Constructor. More... | |
CellRenderer (const CellRenderer &old) | |
Copy Constructor. More... | |
RendererBase * | clone () |
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... | |
IFont * | getFont () |
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 CellRenderer * | getInstance (IRendererContainer *cnt) |
Gets instance for interface access. More... | |
Private Attributes | |
SDL_Color | m_blockerColor |
SDL_Color | m_pathColor |
bool | m_blockingEnabled |
bool | m_pathVisualEnabled |
IFont * | m_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 |
RenderBackend * | m_renderbackend |
Definition at line 42 of file cellrenderer.h.
FIFE::CellRenderer::CellRenderer | ( | RenderBackend * | renderbackend, |
int32_t | position | ||
) |
Constructor.
renderbackend | The renderbackend to use. |
position | The 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().
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().
|
virtual |
Destructor.
Definition at line 80 of file cellrenderer.cpp.
void FIFE::CellRenderer::addPathVisual | ( | Instance * | instance | ) |
Adds a instance to path visualization.
The current path is automatically rendered.
instance | The instance's path is visualized. |
Definition at line 253 of file cellrenderer.cpp.
References m_visualPaths.
|
virtual |
Makes copy of this renderer.
Implements FIFE::RendererBase.
Definition at line 76 of file cellrenderer.cpp.
References CellRenderer().
IFont * FIFE::CellRenderer::getFont | ( | ) |
Returns the font.
Definition at line 249 of file cellrenderer.cpp.
References m_font.
|
static |
Gets instance for interface access.
Definition at line 83 of file cellrenderer.cpp.
References FIFE::IRendererContainer::getRenderer().
|
virtual |
Returns the renderer name.
Implements FIFE::RendererBase.
Definition at line 87 of file cellrenderer.cpp.
bool FIFE::CellRenderer::isEnabledBlocking | ( | ) |
Gets whether blocking visualization is enabled.
Definition at line 233 of file cellrenderer.cpp.
References m_blockingEnabled.
bool FIFE::CellRenderer::isEnabledCost | ( | const std::string & | costId | ) |
Gets whether a cost visualization is enabled.
costId | The cost identifier as string. |
Definition at line 276 of file cellrenderer.cpp.
References m_visualCosts.
bool FIFE::CellRenderer::isEnabledPathVisual | ( | ) |
Gets whether path visualization is enabled.
Definition at line 241 of file cellrenderer.cpp.
References m_pathVisualEnabled.
void FIFE::CellRenderer::removePathVisual | ( | Instance * | instance | ) |
Removes a instance from path visualization.
instance | The instance's path is visualized. |
Definition at line 257 of file cellrenderer.cpp.
References m_visualPaths.
|
virtual |
This method is called by the view to ask renderer to draw its rendering aspect based on given parameters.
cam | Camera view to draw |
layer | Current layer to be rendered |
instances | Instances on the current layer |
Implements FIFE::RendererBase.
Definition at line 91 of file cellrenderer.cpp.
References FIFE::_log, FIFE::CTYPE_NO_BLOCKER, FIFE::RenderBackend::drawLine(), FIFE::Math< T >::Equal(), FL_WARN, FIFE::IFont::getAsImage(), FIFE::Layer::getCellCache(), FIFE::CellCache::getCellCosts(), FIFE::Layer::getCellGrid(), FIFE::CellCache::getCellsInRect(), FIFE::CellCache::getCost(), FIFE::Image::getHeight(), FIFE::Camera::getLayerViewPort(), FIFE::Location::getMapCoordinates(), FIFE::Route::getPath(), FIFE::CellGrid::getVertices(), FIFE::Image::getWidth(), FIFE::Camera::getZoom(), FIFE::RectType< T >::h, m_blockerColor, m_blockingEnabled, m_font, m_pathColor, m_pathVisualEnabled, FIFE::RendererBase::m_renderbackend, m_visualCosts, m_visualPaths, FIFE::Image::render(), FIFE::Location::setLayerCoordinates(), 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.
void FIFE::CellRenderer::setBlockerColor | ( | uint8_t | r, |
uint8_t | g, | ||
uint8_t | b | ||
) |
Sets color that is used to visualize blocker.
r | The value for red, range 0-255. |
g | The value for green, range 0-255. |
b | The value for blue, range 0-255. |
Definition at line 217 of file cellrenderer.cpp.
References m_blockerColor.
void FIFE::CellRenderer::setEnabledBlocking | ( | bool | enabled | ) |
Enables blocking visualization.
enabled | A bool that enables or disables the visualization. |
Definition at line 229 of file cellrenderer.cpp.
References m_blockingEnabled.
void FIFE::CellRenderer::setEnabledCost | ( | const std::string & | costId, |
bool | enabled | ||
) |
Enables cost visualization.
costId | The cost identifier as string. |
enabled | A bool that enables or disables the visualization. |
Definition at line 268 of file cellrenderer.cpp.
References m_visualCosts.
void FIFE::CellRenderer::setEnabledPathVisual | ( | bool | enabled | ) |
Enables path visualization.
enabled | A bool that enables or disables the visualization. |
Definition at line 237 of file cellrenderer.cpp.
References m_pathVisualEnabled.
void FIFE::CellRenderer::setFont | ( | IFont * | font | ) |
Sets the font.
font | The used font. |
Definition at line 245 of file cellrenderer.cpp.
References m_font.
void FIFE::CellRenderer::setPathColor | ( | uint8_t | r, |
uint8_t | g, | ||
uint8_t | b | ||
) |
Sets color that is used to visualize paths.
r | The value for red, range 0-255. |
g | The value for green, range 0-255. |
b | The value for blue, range 0-255. |
Definition at line 223 of file cellrenderer.cpp.
References m_pathColor.
|
private |
Definition at line 162 of file cellrenderer.h.
Referenced by CellRenderer(), render(), and setBlockerColor().
|
private |
Definition at line 164 of file cellrenderer.h.
Referenced by CellRenderer(), isEnabledBlocking(), render(), and setEnabledBlocking().
|
private |
Definition at line 166 of file cellrenderer.h.
Referenced by CellRenderer(), getFont(), render(), and setFont().
|
private |
Definition at line 163 of file cellrenderer.h.
Referenced by CellRenderer(), render(), and setPathColor().
|
private |
Definition at line 165 of file cellrenderer.h.
Referenced by CellRenderer(), isEnabledPathVisual(), render(), and setEnabledPathVisual().
|
private |
Definition at line 169 of file cellrenderer.h.
Referenced by isEnabledCost(), render(), and setEnabledCost().
|
private |
Definition at line 168 of file cellrenderer.h.
Referenced by addPathVisual(), removePathVisual(), and render().