FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
offrenderer.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2019 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_OFFRENDERER_H
23 #define FIFE_OFFRENDERER_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 "video/animation.h"
34 
35 namespace FIFE {
36  class RenderBackend;
37  class IFont;
38 
40  public:
41  virtual void render(RenderBackend* renderbackend) {};
43  };
44 
46  public:
47  void render(RenderBackend* renderbackend);
49  virtual ~OffRendererLineInfo() {};
50  private:
51  Point m_edge1;
57  };
59  public:
60  void render(RenderBackend* renderbackend);
62  virtual ~OffRendererPointInfo() {};
63  private:
64  Point m_anchor;
69  };
71  public:
72  void render(RenderBackend* renderbackend);
75  private:
76  Point m_edge1;
83  };
85  public:
86  void render(RenderBackend* renderbackend);
88  virtual ~OffRendererQuadInfo() {};
89  private:
90  Point m_edge1;
98  };
99 
101  public:
102  void render(RenderBackend* renderbackend);
103  OffRendererVertexInfo(Point center, int32_t size, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
105  private:
106  Point m_center;
107  int32_t m_size;
112  };
113 
115  public:
116  void render(RenderBackend* renderbackend);
118  virtual ~OffRendererImageInfo() {};
119  private:
120  Point m_anchor;
122  };
124  public:
125  void render(RenderBackend* renderbackend);
128  private:
129  Point m_anchor;
133  };
135  public:
136  void render(RenderBackend* renderbackend);
137  OffRendererTextInfo(Point n, IFont* font, std::string text);
138  virtual ~OffRendererTextInfo() {};
139  private:
140  Point m_anchor;
142  std::string m_text;
143  };
145  public:
146  void render(RenderBackend* renderbackend);
147  OffRendererResizeInfo(Point n, ImagePtr image, int32_t width, int32_t height);
149  private:
150  Point m_anchor;
152  int32_t m_width;
153  int32_t m_height;
154  };
155  class OffRenderer {
156  public:
160  OffRenderer(RenderBackend* renderbackend);
161 
164  virtual ~OffRenderer();
165 
166  void setEnabled(bool enabled);
167  bool isEnabled();
168  void setClipArea(Rect area);
169  const Rect& getClipArea() const;
170  void render();
171 
172  void addLine(const std::string &group, Point n1, Point n2, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255);
173  void addPoint(const std::string &group, Point n, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255);
174  void addTriangle(const std::string &group, Point n1, Point n2, Point n3, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255);
175  void addQuad(const std::string &group, Point n1, Point n2, Point n3, Point n4, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255);
176  void addVertex(const std::string &group, Point n, int32_t size, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255);
177  void addText(const std::string &group, Point n, IFont* font, const std::string &text);
178  void addImage(const std::string &group, Point n, ImagePtr image);
179  void addAnimation(const std::string &group, Point n, AnimationPtr animation);
180  void resizeImage(const std::string &group, Point n, ImagePtr image, int32_t width, int32_t height);
181  void removeAll(const std::string &group);
182  void removeAll();
183 
184  private:
185  std::map<std::string, std::vector<OffRendererElementInfo*> > m_groups;
187  bool m_enabled;
189  };
190 
191 }
192 
193 #endif
Abstract interface for all the renderbackends.
virtual void render(RenderBackend *renderbackend)
Definition: offrenderer.h:41
unsigned char uint8_t
Definition: core.h:38
std::map< std::string, std::vector< OffRendererElementInfo * > > m_groups
Definition: offrenderer.h:185
virtual ~OffRendererQuadInfo()
Definition: offrenderer.h:88
virtual ~OffRendererLineInfo()
Definition: offrenderer.h:49
Pure abstract Font interface.
Definition: ifont.h:43
RenderBackend * m_renderbackend
Definition: offrenderer.h:186
unsigned int uint32_t
Definition: core.h:40