Crazy Eddie's GUI System  0.8.4
Renderer.h
00001 /***********************************************************************
00002     created:    Fri Jan 15 2010
00003     author:     Eugene Marcotte
00004 *************************************************************************/
00005 /***************************************************************************
00006  *   Copyright (C) 2004 - 2011 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 _CEGUINullRenderer_h_
00028 #define _CEGUINullRenderer_h_
00029 
00030 #include "../../Renderer.h"
00031 #include "../../Size.h"
00032 #include "../../Vector.h"
00033 
00034 #include <vector>
00035 #include <map>
00036 
00037 #if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(CEGUI_STATIC)
00038 #   ifdef CEGUINULLRENDERER_EXPORTS
00039 #       define NULL_GUIRENDERER_API __declspec(dllexport)
00040 #   else
00041 #       define NULL_GUIRENDERER_API __declspec(dllimport)
00042 #   endif
00043 #else
00044 #   define NULL_GUIRENDERER_API
00045 #endif
00046 
00047 #if defined(_MSC_VER)
00048 #   pragma warning(push)
00049 #   pragma warning(disable : 4251)
00050 #endif
00051 
00052 
00053 // Start of CEGUI namespace section
00054 namespace CEGUI
00055 {
00056 class NullGeometryBuffer;
00057 class NullTexture;
00058 
00060 class NULL_GUIRENDERER_API NullRenderer : public Renderer
00061 {
00062 public:
00080     static NullRenderer& bootstrapSystem(const int abi = CEGUI_VERSION_ABI);
00081     
00097     static void destroySystem();
00098 
00103     static NullRenderer& create(const int abi = CEGUI_VERSION_ABI);
00104 
00106     static void destroy(NullRenderer& renderer);
00107 
00108     // implement CEGUI::Renderer interface
00109     RenderTarget& getDefaultRenderTarget();
00110     GeometryBuffer& createGeometryBuffer();
00111     void destroyGeometryBuffer(const GeometryBuffer& buffer);
00112     void destroyAllGeometryBuffers();
00113     TextureTarget* createTextureTarget();
00114     void destroyTextureTarget(TextureTarget* target);
00115     void destroyAllTextureTargets();
00116     Texture& createTexture(const String& name);
00117     Texture& createTexture(const String& name,
00118                            const String& filename,
00119                            const String& resourceGroup);
00120     Texture& createTexture(const String& name, const Sizef& size);
00121     void destroyTexture(Texture& texture);
00122     void destroyTexture(const String& name);
00123     void destroyAllTextures();
00124     Texture& getTexture(const String& name) const;
00125     bool isTextureDefined(const String& name) const;
00126     void beginRendering();
00127     void endRendering();
00128     void setDisplaySize(const Sizef& sz);
00129     const Sizef& getDisplaySize() const;
00130     const Vector2f& getDisplayDPI() const;
00131     uint getMaxTextureSize() const;
00132     const String& getIdentifierString() const;
00133 
00134 protected:
00136     NullRenderer();
00138         void constructor_impl();
00140     virtual ~NullRenderer();
00141 
00143     void throwIfNameExists(const String& name) const;
00145     static void logTextureCreation(const String& name);
00147     static void logTextureDestruction(const String& name);
00148 
00150     static String d_rendererID;
00152     Sizef d_displaySize;
00154     Vector2f d_displayDPI;
00156     RenderTarget* d_defaultTarget;
00158     typedef std::vector<TextureTarget*> TextureTargetList;
00160     TextureTargetList d_textureTargets;
00162     typedef std::vector<NullGeometryBuffer*> GeometryBufferList;
00164     GeometryBufferList d_geometryBuffers;
00166     typedef std::map<String, NullTexture*, StringFastLessCompare
00167                      CEGUI_MAP_ALLOC(String, NullTexture*)> TextureMap;
00169     TextureMap d_textures;
00171     uint d_maxTextureSize;
00172 };
00173 
00174 
00175 } // End of  CEGUI namespace section
00176 
00177 #if defined(_MSC_VER)
00178 #   pragma warning(pop)
00179 #endif
00180 
00181 #endif  // end of guard _CEGUINullRenderer_h_
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends