Crazy Eddies GUI System: d3d9texture.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

# d3d9texture.h

    00001 /************************************************************************
    00002         filename:       d3d9texture.h
    00003         created:        17/7/2004
    00004         author:         Paul D Turner with D3D 9 Updates by Magnus Österlind
    00005
    00006         purpose:        Defines concrete texture class for D3D9.0
    00007 *************************************************************************/
    00008 /*************************************************************************
    00009     Crazy Eddie's GUI System (http://www.cegui.org.uk)
    00010     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
    00011
    00012     This library is free software; you can redistribute it and/or
    00013     modify it under the terms of the GNU Lesser General Public
    00014     License as published by the Free Software Foundation; either
    00015     version 2.1 of the License, or (at your option) any later version.
    00016
    00017     This library is distributed in the hope that it will be useful,
    00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00020     Lesser General Public License for more details.
    00021
    00022     You should have received a copy of the GNU Lesser General Public
    00023     License along with this library; if not, write to the Free Software
    00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00025 *************************************************************************/
    00026 #ifndef _d3d9texture_h_
    00027 #define _d3d9texture_h_
    00028
    00029 #include "CEGUIBase.h"
    00030 #include "CEGUIRenderer.h"
    00031 #include "CEGUITexture.h"
    00032 #include "d3d9renderer.h"
    00033 #include <d3d9.h>
    00034 #include <list>
    00035
    00036 // Start of CEGUI namespace section
    00037 namespace CEGUI
    00038 {
    00039
    00044 class DIRECTX9_GUIRENDERER_API DirectX9Texture : public Texture
    00045 {
    00046 private:
    00047         /*************************************************************************
    00048                 Friends (to allow construction and destruction)
    00049         *************************************************************************/
    00050         friend  Texture* DirectX9Renderer::createTexture(void);
    00051         friend  Texture* DirectX9Renderer::createTexture(const String& filename, const String& resourceGroup);
    00052         friend  Texture* DirectX9Renderer::createTexture(float size);
    00053         friend  void     DirectX9Renderer::destroyTexture(Texture* texture);
    00054
    00055
    00056         /*************************************************************************
    00057                 Construction & Destruction (by Renderer object only)
    00058         *************************************************************************/
    00059         DirectX9Texture(Renderer* owner);
    00060         virtual ~DirectX9Texture(void);
    00061
    00062 public:
    00070         virtual ushort  getWidth(void) const            {return d_width;}
    00071
    00072
    00080         virtual ushort  getHeight(void) const           {return d_height;}
    00081
    00082
    00096         virtual void    loadFromFile(const String& filename, const String& resourceGroup);
    00097
    00098
    00115         virtual void    loadFromMemory(const void* buffPtr, uint buffWidth, uint buffHeight);
    00116
    00117
    00125         LPDIRECT3DTEXTURE9      getD3DTexture(void) const               {return d_d3dtexture;}
    00126
    00127
    00128         //
    00139         void    setD3DTextureSize(uint size);
    00140
    00141
    00153         virtual void    preD3DReset(void);
    00154
    00155
    00167         virtual void    postD3DReset(void);
    00168
    00169
    00170 private:
    00171         /*************************************************************************
    00172                 Implementation Functions
    00173         *************************************************************************/
    00174         // safely free direc3d texture (can be called multiple times with no ill effect)
    00175         void    freeD3DTexture(void);
    00176
    00177
    00178         /*************************************************************************
    00179                 Implementation Data
    00180         *************************************************************************/
    00181         LPDIRECT3DTEXTURE9              d_d3dtexture;
    00182         String                                  d_filename;
    00183     String                  d_resourceGroup;
    00184         bool                                    d_isMemoryTexture;
    00185
    00186         ushort                                  d_width;
    00187         ushort                                  d_height;
    00188 };
    00189
    00190 } // End of  CEGUI namespace section
    00191
    00192
    00193 #endif  // end of guard _d3d9texture_h_