# CEGUIRenderer.h

    00001 /************************************************************************
    00002         filename:       CEGUIRenderer.h
    00003         created:        20/2/2004
    00004         author:         Paul D Turner
    00005
    00006         purpose:        Defines interface for abstract Renderer class
    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 _CEGUIRenderer_h_
    00027 #define _CEGUIRenderer_h_
    00028
    00029 #include "CEGUIBase.h"
    00030 #include "CEGUIString.h"
    00031 #include "CEGUIRect.h"
    00032 #include "CEGUIColourRect.h"
    00033 #include "CEGUIEventSet.h"
    00034
    00035
    00036 // Start of CEGUI namespace section
    00037 namespace CEGUI
    00038 {
    00043 enum OrientationFlags {
    00044         FlipHorizontal          = 1,
    00045         FlipVertical            = 2,
    00046         RotateRightAngle        = 4
    00047 };
    00048
    00053 enum QuadSplitMode
    00054 {
    00055         TopLeftToBottomRight,
    00056         BottomLeftToTopRight
    00057 };
    00058
    00059
    00068 class CEGUIEXPORT Renderer : public EventSet
    00069 {
    00070 public:
    00071         static const String EventNamespace;
    00072
    00073         /*************************************************************************
    00074                 Event name constants
    00075         *************************************************************************/
    00082         static const String EventDisplaySizeChanged;
    00083
    00084
    00085         /*************************************************************************
    00086                 Abstract interface methods
    00087         *************************************************************************/
    00113         virtual void    addQuad(const Rect& dest_rect, float z, const Texture* tex, const Rect& texture_rect, const ColourRect& colours, QuadSplitMode quad_split_mode) = 0;
    00114
    00115
    00125         virtual void    doRender(void) = 0;
    00126
    00127
    00135         virtual void    clearRenderList(void) = 0;
    00136
    00137
    00153         virtual void    setQueueingEnabled(bool setting) = 0;
    00154
    00155
    00164         virtual Texture*        createTexture(void) = 0;
    00165
    00166
    00186         virtual Texture*        createTexture(const String& filename, const String& resourceGroup) = 0;
    00187
    00188
    00204         virtual Texture*        createTexture(float size) = 0;
    00205
    00206
    00217         virtual void            destroyTexture(Texture* texture) = 0;
    00218
    00219
    00227         virtual void            destroyAllTextures(void) = 0;
    00228
    00229
    00237         virtual bool    isQueueingEnabled(void) const = 0;
    00238
    00239
    00247         virtual float   getWidth(void) const    = 0;
    00248
    00249
    00257         virtual float   getHeight(void) const   = 0;
    00258
    00259
    00267         virtual Size    getSize(void) const             = 0;
    00268
    00269
    00278         virtual Rect    getRect(void) const             = 0;
    00279
    00280
    00288         virtual uint    getMaxTextureSize(void) const   = 0;
    00289
    00290
    00298         virtual uint    getHorzScreenDPI(void) const    = 0;
    00299
    00300
    00308         virtual uint    getVertScreenDPI(void) const    = 0;
    00309
    00310
    00311         /*************************************************************************
    00312                 Basic stuff we provide in base class
    00313         *************************************************************************/
    00321         void    resetZValue(void)                               {d_current_z = GuiZInitialValue;}
    00322
    00323
    00331         void    advanceZValue(void)                             {d_current_z -= GuiZElementStep;}
    00332
    00333
    00341         float   getCurrentZ(void) const                 {return d_current_z;}
    00342
    00343
    00355         float   getZLayer(uint layer) const             {return d_current_z - ((float)layer * GuiZLayerStep);}
    00356
    00357
    00366     const String& getIdentifierString() const;
    00367
    00368     virtual ResourceProvider* createResourceProvider(void);
    00369
    00370 protected:
    00371         /*************************************************************************
    00372                 Construction and Destruction
    00373         *************************************************************************/
    00374         Renderer(void);
    00375
    00376 public:         // for luabind support
    00377         virtual ~Renderer(void);
    00378
    00379 private:
    00380         /*************************************************************************
    00381                 Implementation constants
    00382         *************************************************************************/
    00383         static const float      GuiZInitialValue;
    00384         static const float      GuiZElementStep;
    00385         static const float      GuiZLayerStep;
    00386
    00387
    00388         /*************************************************************************
    00389                 Implementation Data
    00390         *************************************************************************/
    00391         float   d_current_z;
    00392
    00393 protected:
    00394     ResourceProvider* d_resourceProvider;
    00395     String d_identifierString;
    00396 };
    00397
    00398 } // End of  CEGUI namespace section
    00399
    00400
    00401 #endif  // end of guard _CEGUIRenderer_h_