Crazy Eddie's GUI System  0.8.4
Renderer.h
00001 /***********************************************************************
00002     created:    Tue Mar 10 2009
00003     author:     Paul D Turner (parts based on code by Keith Mok)
00004 *************************************************************************/
00005 /***************************************************************************
00006  *   Copyright (C) 2004 - 2009 Paul D Turner & The CEGUI Development Team
00007  *
00008  *   Permission is hereby granted, free of charge, to any person obtaining
00009  *   a copy of this software and associated documentation files (the
00010  *   "Software"), to deal in the Software without restriction, including
00011  *   without limitation the rights to use, copy, modify, merge, publish,
00012  *   distribute, sublicense, and/or sell copies of the Software, and to
00013  *   permit persons to whom the Software is furnished to do so, subject to
00014  *   the following conditions:
00015  *
00016  *   The above copyright notice and this permission notice shall be
00017  *   included in all copies or substantial portions of the Software.
00018  *
00019  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00020  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00021  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00022  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00023  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00024  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00025  *   OTHER DEALINGS IN THE SOFTWARE.
00026  ***************************************************************************/
00027 #ifndef _CEGUIDirectFBRenderer_h_
00028 #define _CEGUIDirectFBRenderer_h_
00029 
00030 #include "CEGUI/Renderer.h"
00031 #include "CEGUI/Size.h"
00032 #include "CEGUI/Vector.h"
00033 #include <directfb.h>
00034 #include <vector>
00035 #include <map>
00036 
00037 // Start of CEGUI namespace section
00038 namespace CEGUI
00039 {
00040 class DirectFBTexture;
00041 class DirectFBGeometryBuffer;
00042 
00044 class DirectFBRenderer : public Renderer
00045 {
00046 public:
00048     static DirectFBRenderer& create(IDirectFB& directfb,
00049                                     IDirectFBSurface& surface,
00050                                     const int abi = CEGUI_VERSION_ABI);
00052     static void destroy(DirectFBRenderer& renderer);
00053 
00055     IDirectFBSurface& getTargetSurface() const;
00056 
00058     void setTargetSurface(IDirectFBSurface& surface);
00059 
00060     // Implementation of Renderer interface.
00061     RenderTarget& getDefaultRenderTarget();
00062     GeometryBuffer& createGeometryBuffer();
00063     void destroyGeometryBuffer(const GeometryBuffer& buffer);
00064     void destroyAllGeometryBuffers();
00065     TextureTarget* createTextureTarget();
00066     void destroyTextureTarget(TextureTarget* target);
00067     void destroyAllTextureTargets();
00068     Texture& createTexture(const CEGUI::String& name);
00069     Texture& createTexture(const CEGUI::String& name,
00070                            const String& filename,
00071                            const String& resourceGroup);
00072     Texture& createTexture(const CEGUI::String& name, const Sizef& size);
00073     void destroyTexture(Texture& texture);
00074     void destroyTexture(const CEGUI::String& name);
00075     void destroyAllTextures();
00076     Texture& getTexture(const String&) const;
00077     bool isTextureDefined(const String& name) const;
00078     void beginRendering();
00079     void endRendering();
00080     void setDisplaySize(const Sizef& sz);
00081     const Sizef& getDisplaySize() const;
00082     const Vector2f& getDisplayDPI() const;
00083     uint getMaxTextureSize() const;
00084     const String& getIdentifierString() const;
00085 
00086 protected:
00088     DirectFBRenderer(IDirectFB& directfb, IDirectFBSurface& surface);
00090     ~DirectFBRenderer();
00091 
00093     static void logTextureCreation(DirectFBTexture* texture);
00095     static void logTextureDestruction(DirectFBTexture* texture);
00096 
00098     static String d_rendererID;
00100     IDirectFB& d_directfb;
00102     IDirectFBSurface& d_rootSurface;
00104     IDirectFBSurface* d_targetSurface;
00106     Sizef d_displaySize;
00108     Vector2f d_displayDPI;
00110     RenderTarget* d_defaultTarget;
00112     typedef std::vector<TextureTarget*> TextureTargetList;
00114     TextureTargetList d_textureTargets;
00116     typedef std::vector<DirectFBGeometryBuffer*> GeometryBufferList;
00118     GeometryBufferList d_geometryBuffers;
00120     typedef std::map<String, DirectFBTexture*, StringFastLessCompare> TextureMap;
00122     TextureMap d_textures;
00123 };
00124 
00125 } // End of  CEGUI namespace section
00126 
00127 #endif  // end of guard _CEGUIDirectFBRenderer_h_
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends