Crazy Eddie's GUI System
0.8.4
|
00001 /*********************************************************************** 00002 created: Tue Mar 3 2009 00003 author: Paul D Turner (parts based on original code by Thomas Suter) 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 _CEGUIIrrlichtRenderer_h_ 00028 #define _CEGUIIrrlichtRenderer_h_ 00029 00030 #include "CEGUI/RendererModules/Irrlicht/RendererDef.h" 00031 #include "../../Renderer.h" 00032 #include "../../Size.h" 00033 #include "../../Vector.h" 00034 00035 #include <vector> 00036 #include <map> 00037 00038 #if defined(_MSC_VER) 00039 # pragma warning(push) 00040 # pragma warning(disable : 4251) 00041 #endif 00042 00043 // forward reference irrlicht classes 00044 namespace irr 00045 { 00046 class IrrlichtDevice; 00047 struct SEvent; 00048 00049 namespace video 00050 { 00051 class IVideoDriver; 00052 } 00053 00054 namespace io 00055 { 00056 class IFileSystem; 00057 } 00058 00059 } 00060 00061 // Start of CEGUI namespace section 00062 namespace CEGUI 00063 { 00064 class IrrlichtTexture; 00065 class IrrlichtGeometryBuffer; 00066 class IrrlichtResourceProvider; 00067 class IrrlichtEventPusher; 00068 class IrrlichtImageCodec; 00069 00071 class IRR_GUIRENDERER_API IrrlichtRenderer : public Renderer 00072 { 00073 public: 00095 static IrrlichtRenderer& bootstrapSystem(irr::IrrlichtDevice& device, 00096 const int abi = CEGUI_VERSION_ABI); 00097 00114 static void destroySystem(); 00115 00117 static IrrlichtRenderer& create(irr::IrrlichtDevice& device, 00118 const int abi = CEGUI_VERSION_ABI); 00119 00121 static void destroy(IrrlichtRenderer& renderer); 00122 00124 static IrrlichtResourceProvider& 00125 createIrrlichtResourceProvider(irr::io::IFileSystem& fs); 00126 00128 static void destroyIrrlichtResourceProvider(IrrlichtResourceProvider& rp); 00129 00131 static IrrlichtImageCodec& createIrrlichtImageCodec( 00132 irr::video::IVideoDriver& driver); 00133 00135 static void destroyIrrlichtImageCodec(IrrlichtImageCodec& ic); 00136 00138 bool injectEvent(const irr::SEvent& event); 00139 00150 Sizef getAdjustedTextureSize(const Sizef& sz) const; 00151 00157 static float getNextPOTSize(const float f); 00158 00159 // implement Renderer interface 00160 RenderTarget& getDefaultRenderTarget(); 00161 GeometryBuffer& createGeometryBuffer(); 00162 void destroyGeometryBuffer(const GeometryBuffer& buffer); 00163 void destroyAllGeometryBuffers(); 00164 TextureTarget* createTextureTarget(); 00165 void destroyTextureTarget(TextureTarget* target); 00166 void destroyAllTextureTargets(); 00167 Texture& createTexture(const String& name); 00168 Texture& createTexture(const String& name, 00169 const String& filename, 00170 const String& resourceGroup); 00171 Texture& createTexture(const String& name, const Sizef& size); 00172 void destroyTexture(Texture& texture); 00173 void destroyTexture(const String& name); 00174 void destroyAllTextures(); 00175 Texture& getTexture(const String& name) const; 00176 bool isTextureDefined(const String& name) const; 00177 void beginRendering(); 00178 void endRendering(); 00179 void setDisplaySize(const Sizef& sz); 00180 const Sizef& getDisplaySize() const; 00181 const Vector2f& getDisplayDPI() const; 00182 uint getMaxTextureSize() const; 00183 const String& getIdentifierString() const; 00184 const IrrlichtEventPusher* getEventPusher() const; 00185 00186 protected: 00188 IrrlichtRenderer(irr::IrrlichtDevice& device); 00190 ~IrrlichtRenderer(); 00191 00193 void throwIfNameExists(const String& name) const; 00195 static void logTextureCreation(const String& name); 00197 static void logTextureDestruction(const String& name); 00198 00200 static String d_rendererID; 00202 irr::IrrlichtDevice& d_device; 00204 irr::video::IVideoDriver* d_driver; 00206 Sizef d_displaySize; 00208 Vector2f d_displayDPI; 00210 RenderTarget* d_defaultTarget; 00212 typedef std::vector<TextureTarget*> TextureTargetList; 00214 TextureTargetList d_textureTargets; 00216 typedef std::vector<IrrlichtGeometryBuffer*> GeometryBufferList; 00218 GeometryBufferList d_geometryBuffers; 00220 typedef std::map<String, IrrlichtTexture*, StringFastLessCompare 00221 CEGUI_MAP_ALLOC(String, IrrlichtTexture*)> TextureMap; 00223 TextureMap d_textures; 00225 uint d_maxTextureSize; 00227 IrrlichtEventPusher* d_eventPusher; 00229 bool d_supportsNSquareTextures; 00231 bool d_supportsNPOTTextures; 00232 }; 00233 00234 } // End of CEGUI namespace section 00235 00236 #if defined(_MSC_VER) 00237 # pragma warning(pop) 00238 #endif 00239 00240 #endif // end of guard _CEGUIIrrlichtRenderer_h_