Crazy Eddie's GUI System  0.8.4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
RendererModules/DirectFB/Renderer.h
1 /***********************************************************************
2  created: Tue Mar 10 2009
3  author: Paul D Turner (parts based on code by Keith Mok)
4 *************************************************************************/
5 /***************************************************************************
6  * Copyright (C) 2004 - 2009 Paul D Turner & The CEGUI Development Team
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining
9  * a copy of this software and associated documentation files (the
10  * "Software"), to deal in the Software without restriction, including
11  * without limitation the rights to use, copy, modify, merge, publish,
12  * distribute, sublicense, and/or sell copies of the Software, and to
13  * permit persons to whom the Software is furnished to do so, subject to
14  * the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be
17  * included in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  ***************************************************************************/
27 #ifndef _CEGUIDirectFBRenderer_h_
28 #define _CEGUIDirectFBRenderer_h_
29 
30 #include "CEGUI/Renderer.h"
31 #include "CEGUI/Size.h"
32 #include "CEGUI/Vector.h"
33 #include <directfb.h>
34 #include <vector>
35 #include <map>
36 
37 // Start of CEGUI namespace section
38 namespace CEGUI
39 {
40 class DirectFBTexture;
41 class DirectFBGeometryBuffer;
42 
44 class DirectFBRenderer : public Renderer
45 {
46 public:
48  static DirectFBRenderer& create(IDirectFB& directfb,
49  IDirectFBSurface& surface,
50  const int abi = CEGUI_VERSION_ABI);
52  static void destroy(DirectFBRenderer& renderer);
53 
55  IDirectFBSurface& getTargetSurface() const;
56 
58  void setTargetSurface(IDirectFBSurface& surface);
59 
60  // Implementation of Renderer interface.
63  void destroyGeometryBuffer(const GeometryBuffer& buffer);
66  void destroyTextureTarget(TextureTarget* target);
68  Texture& createTexture(const CEGUI::String& name);
69  Texture& createTexture(const CEGUI::String& name,
70  const String& filename,
71  const String& resourceGroup);
72  Texture& createTexture(const CEGUI::String& name, const Sizef& size);
73  void destroyTexture(Texture& texture);
74  void destroyTexture(const CEGUI::String& name);
75  void destroyAllTextures();
76  Texture& getTexture(const String&) const;
77  bool isTextureDefined(const String& name) const;
78  void beginRendering();
79  void endRendering();
80  void setDisplaySize(const Sizef& sz);
81  const Sizef& getDisplaySize() const;
82  const Vector2f& getDisplayDPI() const;
83  uint getMaxTextureSize() const;
84  const String& getIdentifierString() const;
85 
86 protected:
88  DirectFBRenderer(IDirectFB& directfb, IDirectFBSurface& surface);
91 
93  static void logTextureCreation(DirectFBTexture* texture);
95  static void logTextureDestruction(DirectFBTexture* texture);
96 
100  IDirectFB& d_directfb;
102  IDirectFBSurface& d_rootSurface;
104  IDirectFBSurface* d_targetSurface;
112  typedef std::vector<TextureTarget*> TextureTargetList;
116  typedef std::vector<DirectFBGeometryBuffer*> GeometryBufferList;
120  typedef std::map<String, DirectFBTexture*, StringFastLessCompare> TextureMap;
123 };
124 
125 } // End of CEGUI namespace section
126 
127 #endif // end of guard _CEGUIDirectFBRenderer_h_