FIFE  6e1afdbeda11afe9ac53e6023a4be96ef88f1dc6
cellrenderer.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2017 by the FIFE team *
3  * http://www.fifengine.net *
4  * This file is part of FIFE. *
5  * *
6  * FIFE is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU Lesser General Public *
8  * License as published by the Free Software Foundation; either *
9  * version 2.1 of the License, or (at your option) any later version. *
10  * *
11  * This library is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * Lesser General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Lesser General Public *
17  * License along with this library; if not, write to the *
18  * Free Software Foundation, Inc., *
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20  ***************************************************************************/
21 
22 #ifndef FIFE_CELLRENDERER_H
23 #define FIFE_CELLRENDERER_H
24 
25 // Standard C++ library includes
26 
27 // 3rd party library includes
28 
29 // FIFE includes
30 // These includes are split up in two parts, separated by one empty line
31 // First block: files included from the FIFE root src directory
32 // Second block: files included from the same folder
33 #include "view/rendererbase.h"
34 
35 #include "targetrenderer.h"
36 
37 namespace FIFE {
38  class RenderBackend;
39  class Cell;
40  class IFont;
41 
42  class CellRenderer: public RendererBase {
43  public:
50  CellRenderer(RenderBackend* renderbackend, int32_t position);
51 
54  CellRenderer(const CellRenderer& old);
55 
59 
62  virtual ~CellRenderer();
63 
68  std::string getName();
69 
77  void render(Camera* cam, Layer* layer, RenderList& instances);
78 
85  void setBlockerColor(uint8_t r, uint8_t g, uint8_t b);
86 
93  void setPathColor(uint8_t r, uint8_t g, uint8_t b);
94 
99  void setEnabledBlocking(bool enabled);
100 
105  bool isEnabledBlocking();
106 
111  void setEnabledFogOfWar(bool enabled);
112 
117  bool isEnabledFogOfWar();
118 
123  void setEnabledPathVisual(bool enabled);
124 
129  bool isEnabledPathVisual();
130 
135  void setFogOfWarLayer(Layer* layer);
136 
141  void setConcealImage(ImagePtr image);
142 
147  void setMaskImage(ImagePtr image);
148 
153  void addPathVisual(Instance* instance);
154 
159  void removePathVisual(Instance* instance);
160 
166  void createFowMap(Camera* cam, Layer* layer);
167 
175  void addImageToMap(Camera* cam, Point center, ImagePtr image, const std::string& id);
176 
181  Layer* getFowLayer();
182 
188  void setEnabledCost(const std::string& costId, bool enabled);
189 
195  bool isEnabledCost(const std::string& costId);
196 
201  void setFont(IFont* font);
202 
207  IFont* getFont();
208 
211  void updateFowMap();
212 
216 
217  private:
218  SDL_Color m_blockerColor;
219  SDL_Color m_pathColor;
223  // FoW stuff
231 
232  std::vector<Instance*> m_visualPaths;
233  std::set<std::string> m_visualCosts;
234  };
235 }
236 
237 #endif
std::vector< Instance * > m_visualPaths
Definition: cellrenderer.h:232
Abstract interface for all the renderbackends.
static CellRenderer * getInstance(IRendererContainer *cnt)
Gets instance for interface access.
void addPathVisual(Instance *instance)
Adds a instance to path visualization.
void createFowMap(Camera *cam, Layer *layer)
Creates render target for Fog of War.
void setFogOfWarLayer(Layer *layer)
Sets the layer that is used for Fog of War visualization.
std::vector< RenderItem * > RenderList
Definition: renderitem.h:130
void setConcealImage(ImagePtr image)
Sets the image that is used for concealed spaces.
std::set< std::string > m_visualCosts
Definition: cellrenderer.h:233
bool isEnabledFogOfWar()
Gets whether Fog of War visualization is enabled.
Interface to class owning the renderers Used to get correct subclass of renderer in scripting side (v...
Definition: rendererbase.h:66
void setMaskImage(ImagePtr image)
Sets the fog image.
IFont * getFont()
Returns the font.
void setEnabledFogOfWar(bool enabled)
Enables Fog of War visualization.
Camera describes properties of a view port shown in the main screen Main screen can have multiple cam...
Definition: camera.h:59
void setBlockerColor(uint8_t r, uint8_t g, uint8_t b)
Sets color that is used to visualize blocker.
unsigned char uint8_t
Definition: core.h:38
ImagePtr m_concealImage
Definition: cellrenderer.h:227
Base class for all view renderers View renderer renders one aspect of the view shown on screen...
Definition: rendererbase.h:78
void removePathVisual(Instance *instance)
Removes a instance from path visualization.
bool isEnabledCost(const std::string &costId)
Gets whether a cost visualization is enabled.
CellRenderer(RenderBackend *renderbackend, int32_t position)
Constructor.
void setEnabledCost(const std::string &costId, bool enabled)
Enables cost visualization.
A basic layer on a map.
Definition: layer.h:99
TargetRenderer * m_targetRenderer
Definition: cellrenderer.h:224
void setEnabledPathVisual(bool enabled)
Enables path visualization.
void setEnabledBlocking(bool enabled)
Enables blocking visualization.
Layer * getFowLayer()
Returns the layer that is used for Fog of War visualization.
void addImageToMap(Camera *cam, Point center, ImagePtr image, const std::string &id)
Adds image to FoW render target.
Pure abstract Font interface.
Definition: ifont.h:43
void setPathColor(uint8_t r, uint8_t g, uint8_t b)
Sets color that is used to visualize paths.
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 paramet...
void setFont(IFont *font)
Sets the font.
std::string getName()
Returns the renderer name.
SDL_Color m_blockerColor
Definition: cellrenderer.h:218
bool isEnabledBlocking()
Gets whether blocking visualization is enabled.
RenderTargetPtr m_fowTarget
Definition: cellrenderer.h:225
void updateFowMap()
Updates render target.
RendererBase * clone()
Makes copy of this renderer.
SDL_Color m_pathColor
Definition: cellrenderer.h:219
An Instance is an "instantiation" of an Object at a Location.
Definition: instance.h:101
bool isEnabledPathVisual()
Gets whether path visualization is enabled.
virtual ~CellRenderer()
Destructor.