Crazy Eddies GUI System 0.7.6
CEGUIDirectFBRenderer.h
00001 /***********************************************************************
00002     filename:   CEGUIDirectFBRenderer.h
00003     created:    Tue Mar 10 2009
00004     author:     Paul D Turner (parts based on code by Keith Mok)
00005 *************************************************************************/
00006 /***************************************************************************
00007  *   Copyright (C) 2004 - 2009 Paul D Turner & The CEGUI Development Team
00008  *
00009  *   Permission is hereby granted, free of charge, to any person obtaining
00010  *   a copy of this software and associated documentation files (the
00011  *   "Software"), to deal in the Software without restriction, including
00012  *   without limitation the rights to use, copy, modify, merge, publish,
00013  *   distribute, sublicense, and/or sell copies of the Software, and to
00014  *   permit persons to whom the Software is furnished to do so, subject to
00015  *   the following conditions:
00016  *
00017  *   The above copyright notice and this permission notice shall be
00018  *   included in all copies or substantial portions of the Software.
00019  *
00020  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00021  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00022  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00023  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00024  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00025  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00026  *   OTHER DEALINGS IN THE SOFTWARE.
00027  ***************************************************************************/
00028 #ifndef _CEGUIDirectFBRenderer_h_
00029 #define _CEGUIDirectFBRenderer_h_
00030 
00031 #include "../../CEGUIRenderer.h"
00032 #include "../../CEGUISize.h"
00033 #include "../../CEGUIVector.h"
00034 #include <directfb.h>
00035 #include <vector>
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);
00051     static void destroy(DirectFBRenderer& renderer);
00052 
00054     IDirectFBSurface& getTargetSurface() const;
00055 
00057     void setTargetSurface(IDirectFBSurface& surface);
00058 
00059     // Implementation of Renderer interface.
00060     RenderingRoot& getDefaultRenderingRoot();
00061     GeometryBuffer& createGeometryBuffer();
00062     void destroyGeometryBuffer(const GeometryBuffer& buffer);
00063     void destroyAllGeometryBuffers();
00064     TextureTarget* createTextureTarget();
00065     void destroyTextureTarget(TextureTarget* target);
00066     void destroyAllTextureTargets();
00067     Texture& createTexture();
00068     Texture& createTexture(const String& filename, const String& resourceGroup);
00069     Texture& createTexture(const Size& size);
00070     void destroyTexture(Texture& texture);
00071     void destroyAllTextures();
00072     void beginRendering();
00073     void endRendering();
00074     void setDisplaySize(const Size& sz);
00075     const Size& getDisplaySize() const;
00076     const Vector2& getDisplayDPI() const;
00077     uint getMaxTextureSize() const;
00078     const String& getIdentifierString() const;
00079 
00080 protected:
00082     DirectFBRenderer(IDirectFB& directfb, IDirectFBSurface& surface);
00084     ~DirectFBRenderer();
00085 
00087     static String d_rendererID;
00089     IDirectFB& d_directfb;
00091     IDirectFBSurface& d_rootSurface;
00093     IDirectFBSurface* d_targetSurface;
00095     Size d_displaySize;
00097     Vector2 d_displayDPI;
00099     RenderTarget* d_defaultTarget;
00101     RenderingRoot* d_defaultRoot;
00103      typedef std::vector<TextureTarget*> TextureTargetList;
00105     TextureTargetList d_textureTargets;
00107     typedef std::vector<DirectFBGeometryBuffer*> GeometryBufferList;
00109     GeometryBufferList d_geometryBuffers;
00111     typedef std::vector<DirectFBTexture*> TextureList;
00113     TextureList d_textures;
00114 };
00115 
00116 } // End of  CEGUI namespace section
00117 
00118 #endif  // end of guard _CEGUIDirectFBRenderer_h_