Crazy Eddies GUI System  0.6.2
CEGUIRenderCache.h
1 /***********************************************************************
2  filename: CEGUIRenderCache.h
3  created: Fri Jun 17 2005
4  author: Paul D Turner <paul@cegui.org.uk>
5 *************************************************************************/
6 /***************************************************************************
7  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining
10  * a copy of this software and associated documentation files (the
11  * "Software"), to deal in the Software without restriction, including
12  * without limitation the rights to use, copy, modify, merge, publish,
13  * distribute, sublicense, and/or sell copies of the Software, and to
14  * permit persons to whom the Software is furnished to do so, subject to
15  * the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be
18  * included in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26  * OTHER DEALINGS IN THE SOFTWARE.
27  ***************************************************************************/
28 #ifndef _CEGUIRenderCache_h_
29 #define _CEGUIRenderCache_h_
30 
31 #include "CEGUIVector.h"
32 #include "CEGUIRect.h"
33 #include "CEGUIImage.h"
34 #include "CEGUIFont.h"
35 #include <vector>
36 
37 
38 #if defined(_MSC_VER)
39 # pragma warning(push)
40 # pragma warning(disable : 4251)
41 #endif
42 
43 
44 // Start of CEGUI namespace section
45 namespace CEGUI
46 {
63  class CEGUIEXPORT RenderCache
64  {
65  public:
70  RenderCache();
71 
76  ~RenderCache();
77 
86  bool hasCachedImagery() const;
87 
104  void render(const Point& basePos, float baseZ, const Rect& clipper);
105 
110  void clearCachedImagery();
111 
133  void cacheImage(const Image& image, const Rect& destArea, float zOffset, const ColourRect& cols, const Rect* clipper = 0, bool clipToDisplay = false);
134 
162  void cacheText(const String& text, Font* font, TextFormatting format, const Rect& destArea, float zOffset, const ColourRect& cols, const Rect* clipper = 0, bool clipToDisplay = false);
163 
164  private:
169  struct ImageInfo
170  {
171  const Image* source_image;
172  Rect target_area;
173  float z_offset;
174  ColourRect colours;
175  Rect customClipper;
176  bool usingCustomClipper;
177  bool clipToDisplay;
178  };
179 
184  struct TextInfo
185  {
186  String text;
187  Font* source_font;
188  TextFormatting formatting;
189  Rect target_area;
190  float z_offset;
191  ColourRect colours;
192  Rect customClipper;
193  bool usingCustomClipper;
194  bool clipToDisplay;
195  };
196 
197  typedef std::vector<ImageInfo> ImageryList;
198  typedef std::vector<TextInfo> TextList;
199 
200  ImageryList d_cachedImages;
201  TextList d_cachedTexts;
202  };
203 
204 } // End of CEGUI namespace section
205 
206 
207 #if defined(_MSC_VER)
208 # pragma warning(pop)
209 #endif
210 
211 
212 #endif // end of guard _CEGUIRenderCache_h_