Crazy Eddie's GUI System  0.8.3
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
RendererModules/DirectFB/Renderer.h
1 /***********************************************************************
2  filename: CEGUIDirectFBRenderer.h
3  created: Tue Mar 10 2009
4  author: Paul D Turner (parts based on code by Keith Mok)
5 *************************************************************************/
6 /***************************************************************************
7  * Copyright (C) 2004 - 2009 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 _CEGUIDirectFBRenderer_h_
29 #define _CEGUIDirectFBRenderer_h_
30 
31 #include "CEGUI/Renderer.h"
32 #include "CEGUI/Size.h"
33 #include "CEGUI/Vector.h"
34 #include <directfb.h>
35 #include <vector>
36 #include <map>
37 
38 // Start of CEGUI namespace section
39 namespace CEGUI
40 {
41 class DirectFBTexture;
42 class DirectFBGeometryBuffer;
43 
45 class DirectFBRenderer : public Renderer
46 {
47 public:
49  static DirectFBRenderer& create(IDirectFB& directfb,
50  IDirectFBSurface& surface,
51  const int abi = CEGUI_VERSION_ABI);
53  static void destroy(DirectFBRenderer& renderer);
54 
56  IDirectFBSurface& getTargetSurface() const;
57 
59  void setTargetSurface(IDirectFBSurface& surface);
60 
61  // Implementation of Renderer interface.
64  void destroyGeometryBuffer(const GeometryBuffer& buffer);
67  void destroyTextureTarget(TextureTarget* target);
69  Texture& createTexture(const CEGUI::String& name);
70  Texture& createTexture(const CEGUI::String& name,
71  const String& filename,
72  const String& resourceGroup);
73  Texture& createTexture(const CEGUI::String& name, const Sizef& size);
74  void destroyTexture(Texture& texture);
75  void destroyTexture(const CEGUI::String& name);
76  void destroyAllTextures();
77  Texture& getTexture(const String&) const;
78  bool isTextureDefined(const String& name) const;
79  void beginRendering();
80  void endRendering();
81  void setDisplaySize(const Sizef& sz);
82  const Sizef& getDisplaySize() const;
83  const Vector2f& getDisplayDPI() const;
84  uint getMaxTextureSize() const;
85  const String& getIdentifierString() const;
86 
87 protected:
89  DirectFBRenderer(IDirectFB& directfb, IDirectFBSurface& surface);
92 
94  static void logTextureCreation(DirectFBTexture* texture);
96  static void logTextureDestruction(DirectFBTexture* texture);
97 
101  IDirectFB& d_directfb;
103  IDirectFBSurface& d_rootSurface;
105  IDirectFBSurface* d_targetSurface;
113  typedef std::vector<TextureTarget*> TextureTargetList;
117  typedef std::vector<DirectFBGeometryBuffer*> GeometryBufferList;
121  typedef std::map<String, DirectFBTexture*, StringFastLessCompare> TextureMap;
124 };
125 
126 } // End of CEGUI namespace section
127 
128 #endif // end of guard _CEGUIDirectFBRenderer_h_