FIFE  6e1afdbeda11afe9ac53e6023a4be96ef88f1dc6
genericrenderer.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_GENERICRENDERER_H
23 #define FIFE_GENERICRENDERER_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
34 #include "view/rendererbase.h"
35 #include "video/animation.h"
36 
37 namespace FIFE {
38  class RenderBackend;
39  class IFont;
40 
42  public:
43  virtual void render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend) {};
45  };
46 
48  public:
49  void render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend);
52  private:
53  RendererNode m_edge1;
59  };
61  public:
62  void render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend);
65  private:
66  RendererNode m_anchor;
71  };
73  public:
74  void render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend);
77  private:
78  RendererNode m_edge1;
85  };
87  public:
88  void render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend);
91  private:
92  RendererNode m_edge1;
100  };
101 
103  public:
104  void render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend);
105  GenericRendererVertexInfo(RendererNode center, int32_t size, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
107  private:
108  RendererNode m_center;
109  int32_t m_size;
114  };
115 
117  public:
118  void render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend);
119  GenericRendererImageInfo(RendererNode n, ImagePtr image, bool zoomed = true);
121  private:
122  RendererNode m_anchor;
124  bool m_zoomed;
125  };
127  public:
128  void render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend);
129  GenericRendererAnimationInfo(RendererNode n, AnimationPtr animation, bool zoomed = true);
131  private:
132  RendererNode m_anchor;
136  bool m_zoomed;
137  };
139  public:
140  void render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend);
141  GenericRendererTextInfo(RendererNode n, IFont* font, std::string text, bool zoomed = true);
143  private:
144  RendererNode m_anchor;
146  std::string m_text;
147  bool m_zoomed;
148  };
150  public:
151  void render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend);
152  GenericRendererResizeInfo(RendererNode n, ImagePtr image, int32_t width, int32_t height, bool zoomed = true);
154  private:
155  RendererNode m_anchor;
157  int32_t m_width;
158  int32_t m_height;
159  bool m_zoomed;
160  };
162  public:
169  GenericRenderer(RenderBackend* renderbackend, int32_t position);
170 
173  GenericRenderer(const GenericRenderer& old);
174 
177  RendererBase* clone();
178 
181  virtual ~GenericRenderer();
182 
190  void render(Camera* cam, Layer* layer, RenderList& instances);
191 
196  std::string getName() { return "GenericRenderer"; }
197 
200  static GenericRenderer* getInstance(IRendererContainer* cnt);
201 
212  void addLine(const std::string &group, RendererNode n1, RendererNode n2, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255);
213 
223  void addPoint(const std::string &group, RendererNode n, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255);
224 
236  void addTriangle(const std::string &group, RendererNode n1, RendererNode n2, RendererNode n3, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255);
237 
250  void addQuad(const std::string &group, RendererNode n1, RendererNode n2, RendererNode n3, RendererNode n4, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255);
251 
262  void addVertex(const std::string &group, RendererNode n, int32_t size, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255);
263 
272  void addText(const std::string &group, RendererNode n, IFont* font, const std::string &text, bool zoomed = true);
273 
281  void addImage(const std::string &group, RendererNode n, ImagePtr image, bool zoomed = true);
282 
290  void addAnimation(const std::string &group, RendererNode n, AnimationPtr animation, bool zoomed = true);
291 
301  void resizeImage(const std::string &group, RendererNode n, ImagePtr image, int32_t width, int32_t height, bool zoomed = true);
302 
307  void removeAll(const std::string &group);
308 
311  void removeAll();
312 
315  void reset();
316 
317  private:
319  std::map<std::string, std::vector<GenericRendererElementInfo*> > m_groups;
320  };
321 
322 }
323 
324 #endif
Abstract interface for all the renderbackends.
std::vector< RenderItem * > RenderList
Definition: renderitem.h:130
Interface to class owning the renderers Used to get correct subclass of renderer in scripting side (v...
Definition: rendererbase.h:66
virtual void render(Camera *cam, Layer *layer, RenderList &instances, RenderBackend *renderbackend)
Camera describes properties of a view port shown in the main screen Main screen can have multiple cam...
Definition: camera.h:59
unsigned char uint8_t
Definition: core.h:38
std::string getName()
Returns the renderer name.
Base class for all view renderers View renderer renders one aspect of the view shown on screen...
Definition: rendererbase.h:78
A basic layer on a map.
Definition: layer.h:99
Pure abstract Font interface.
Definition: ifont.h:43
std::map< std::string, std::vector< GenericRendererElementInfo * > > m_groups
A map that holds the groups together with the appended render elements.
unsigned int uint32_t
Definition: core.h:40