# irrlichttexture.h

    00001 /************************************************************************
    00002         filename:       irrlichttexture.h
    00003         created:        20/7/2004
    00004         author:         Thomas Suter
    00005 *************************************************************************/
    00006 /*************************************************************************
    00007     Crazy Eddie's GUI System (http://www.cegui.org.uk)
    00008     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
    00009
    00010     This library is free software; you can redistribute it and/or
    00011     modify it under the terms of the GNU Lesser General Public
    00012     License as published by the Free Software Foundation; either
    00013     version 2.1 of the License, or (at your option) any later version.
    00014
    00015     This library is distributed in the hope that it will be useful,
    00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00018     Lesser General Public License for more details.
    00019
    00020     You should have received a copy of the GNU Lesser General Public
    00021     License along with this library; if not, write to the Free Software
    00022     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00023 *************************************************************************/
    00024 #ifndef IRRLICHTTEXTURE_H_INCLUDED
    00025 #define IRRLICHTTEXTURE_H_INCLUDED
    00026
    00027 #include "IrrlichtRendererDef.h"
    00028
    00029 #include "CEGUIBase.h"
    00030 #include "CEGUIRenderer.h"
    00031 #include "CEGUITexture.h"
    00032
    00033 #include <irrlicht.h>
    00034
    00035 namespace CEGUI
    00036 {
    00037         class IRRLICHT_GUIRENDERER_API IrrlichtTexture : public Texture
    00038         {
    00039         public:
    00040
    00041                 // constructor
    00042                 IrrlichtTexture(Renderer* r, irr::IrrlichtDevice* device);
    00043
    00044                 // destructor
    00045                 virtual ~IrrlichtTexture();
    00046
    00047                 // returns the irrlich texture
    00048                 irr::video::ITexture* getTexture();
    00049
    00050                 // set the irrlicht texture
    00051                 void setTexture(irr::video::ITexture* texture);
    00052
    00053
    00061                 virtual ushort  getWidth(void) const;
    00062
    00063
    00071                 virtual ushort  getHeight(void) const;
    00072
    00073
    00087                 virtual void    loadFromFile(const String& filename, const String& resourceGroup);
    00088
    00089
    00106                 virtual void    loadFromMemory(const void* buffPtr, uint buffWidth, uint buffHeight);
    00107
    00108         private:
    00109
    00110                 // counter for unique texture names
    00111                 static int iTextureNumber;
    00112
    00113                 // generate a unique name
    00114                 static irr::core::stringc getUniqueName(void);
    00115
    00116                 // remove the texture from irrlicht textures
    00117                 void freeTexture();
    00118
    00119                 // the current texture for rendering
    00120                 irr::video::ITexture* tex;
    00121
    00122                 // the irrlicht video driver
    00123                 irr::video::IVideoDriver* driver;
    00124
    00125                 // the irrlicht device
    00126                 irr::IrrlichtDevice* device;
    00127
    00128         };
    00129 }
    00130 #endif