Crazy Eddie's GUI System
0.8.4
|
00001 /*********************************************************************** 00002 created: Mon Feb 9 2009 00003 author: Paul D Turner 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 _CEGUIDirect3D9Texture_h_ 00028 #define _CEGUIDirect3D9Texture_h_ 00029 00030 #include "../../Base.h" 00031 #include "../../Renderer.h" 00032 #include "../../Texture.h" 00033 #include "CEGUI/RendererModules/Direct3D9/Renderer.h" 00034 00035 #if defined(_MSC_VER) 00036 # pragma warning(push) 00037 # pragma warning(disable : 4251) 00038 #endif 00039 00040 // Start of CEGUI namespace section 00041 namespace CEGUI 00042 { 00044 class DIRECT3D9_GUIRENDERER_API Direct3D9Texture : public Texture 00045 { 00046 public: 00052 void setDirect3D9Texture(LPDIRECT3DTEXTURE9 tex); 00053 00061 LPDIRECT3DTEXTURE9 getDirect3D9Texture() const; 00062 00070 void setOriginalDataSize(const Sizef& sz); 00071 00073 void preD3DReset(); 00074 00076 void postD3DReset(); 00077 00078 // implement abstract members from base class. 00079 const String& getName() const; 00080 const Sizef& getSize() const; 00081 const Sizef& getOriginalDataSize() const; 00082 const Vector2f& getTexelScaling() const; 00083 void loadFromFile(const String& filename, const String& resourceGroup); 00084 void loadFromMemory(const void* buffer, const Sizef& buffer_size, 00085 PixelFormat pixel_format); 00086 void blitFromMemory(const void* sourceData, const Rectf& area); 00087 void blitToMemory(void* targetData); 00088 bool isPixelFormatSupported(const PixelFormat fmt) const; 00089 00090 protected: 00091 // Friends (to allow construction and destruction) 00092 friend Texture& Direct3D9Renderer::createTexture(const String&); 00093 friend Texture& Direct3D9Renderer::createTexture(const String&, 00094 const String&, 00095 const String&); 00096 friend Texture& Direct3D9Renderer::createTexture(const String&, 00097 const Sizef&); 00098 friend Texture& Direct3D9Renderer::createTexture(const String&, 00099 LPDIRECT3DTEXTURE9 tex); 00100 friend void Direct3D9Renderer::destroyTexture(Texture&); 00101 friend void Direct3D9Renderer::destroyTexture(const String&); 00102 00104 Direct3D9Texture(Direct3D9Renderer& owner, const String& name); 00106 Direct3D9Texture(Direct3D9Renderer& owner, const String& name, 00107 const String& filename, const String& resourceGroup); 00109 Direct3D9Texture(Direct3D9Renderer& owner, const String& name, 00110 const Sizef& sz); 00112 Direct3D9Texture(Direct3D9Renderer& owner, const String& name, 00113 LPDIRECT3DTEXTURE9 tex); 00115 virtual ~Direct3D9Texture(); 00116 00118 void createDirect3D9Texture(const Sizef sz, D3DFORMAT format); 00120 void cleanupDirect3D9Texture(); 00122 IDirect3DSurface9* getTextureSurface() const; 00124 void updateCachedScaleValues(); 00126 void updateTextureSize(); 00127 00129 Direct3D9Renderer& d_owner; 00131 LPDIRECT3DTEXTURE9 d_texture; 00133 Sizef d_size; 00135 Sizef d_dataSize; 00137 Vector2f d_texelScaling; 00139 D3DSURFACE_DESC d_savedSurfaceDesc; 00141 bool d_savedSurfaceDescValid; 00143 const String d_name; 00144 }; 00145 00146 } // End of CEGUI namespace section 00147 00148 #if defined(_MSC_VER) 00149 # pragma warning(pop) 00150 #endif 00151 00152 #endif // end of guard _CEGUIDirect3D9Texture_h_