Crazy Eddies GUI System 0.7.5
CEGUIRenderingSurface.h
00001 /***********************************************************************
00002     filename:   CEGUIRenderingSurface.h
00003     created:    Mon Jan 12 2009
00004     author:     Paul D Turner
00005 *************************************************************************/
00006 /***************************************************************************
00007  *   Copyright (C) 2004 - 2009 Paul D Turner & The CEGUI Development Team
00008  *
00009  *   Permission is hereby granted, free of charge, to any person obtaining
00010  *   a copy of this software and associated documentation files (the
00011  *   "Software"), to deal in the Software without restriction, including
00012  *   without limitation the rights to use, copy, modify, merge, publish,
00013  *   distribute, sublicense, and/or sell copies of the Software, and to
00014  *   permit persons to whom the Software is furnished to do so, subject to
00015  *   the following conditions:
00016  *
00017  *   The above copyright notice and this permission notice shall be
00018  *   included in all copies or substantial portions of the Software.
00019  *
00020  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00021  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00022  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00023  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00024  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00025  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00026  *   OTHER DEALINGS IN THE SOFTWARE.
00027  ***************************************************************************/
00028 #ifndef _CEGUIRenderingSurface_h_
00029 #define _CEGUIRenderingSurface_h_
00030 
00031 #include "CEGUIEventSet.h"
00032 #include "CEGUIEventArgs.h"
00033 #include "CEGUIRenderQueue.h"
00034 
00035 #if defined(_MSC_VER)
00036 #   pragma warning(push)
00037 #   pragma warning(disable : 4251)
00038 #endif
00039 
00040 
00041 // Start of CEGUI namespace section
00042 namespace CEGUI
00043 {
00044 //----------------------------------------------------------------------------//
00046 enum RenderQueueID
00047 {
00048     RQ_USER_0,
00050     RQ_UNDERLAY,
00051     RQ_USER_1,
00053     RQ_BASE,
00054     RQ_USER_2,
00056     RQ_CONTENT_1,
00057     RQ_USER_3,
00059     RQ_CONTENT_2,
00060     RQ_USER_4,
00062     RQ_OVERLAY,
00063     RQ_USER_5
00064 };
00065 
00066 //----------------------------------------------------------------------------//
00067 
00074 class CEGUIEXPORT RenderQueueEventArgs : public EventArgs
00075 {
00076 public:
00085     RenderQueueEventArgs(const RenderQueueID id);
00086 
00088     RenderQueueID queueID;
00089 };
00090 
00091 //----------------------------------------------------------------------------//
00092 
00109 class CEGUIEXPORT RenderingSurface : public EventSet
00110 {
00111 public:
00113     static const String EventNamespace;
00121     static const String EventRenderQueueStarted;
00128     static const String EventRenderQueueEnded;
00129 
00147     RenderingSurface(RenderTarget& target);
00148 
00150     virtual ~RenderingSurface();
00151 
00172     void addGeometryBuffer(const RenderQueueID queue,
00173                            const GeometryBuffer& buffer);
00174 
00186     void removeGeometryBuffer(const RenderQueueID queue,
00187                               const GeometryBuffer& buffer);
00188 
00201     void clearGeometry(const RenderQueueID queue);
00202 
00211     void clearGeometry();
00212 
00223     virtual void draw();
00224 
00237     virtual void invalidate();
00238 
00254     bool isInvalidated() const;
00255 
00265     virtual bool isRenderingWindow() const;
00266 
00289     virtual RenderingWindow& createRenderingWindow(TextureTarget& target);
00290 
00304     virtual void destroyRenderingWindow(RenderingWindow& window);
00305 
00307 
00317     virtual void transferRenderingWindow(RenderingWindow& window);
00318 
00328     const RenderTarget& getRenderTarget() const;
00329     RenderTarget& getRenderTarget();
00330 
00331 protected:
00333     void draw(const RenderQueue& queue, RenderQueueEventArgs& args);
00334 
00336     void detatchWindow(RenderingWindow& w);
00337 
00339     void attachWindow(RenderingWindow& w);
00340 
00342     typedef std::map<RenderQueueID, RenderQueue> RenderQueueList;
00344     typedef std::vector<RenderingWindow*> RenderingWindowList;
00346     RenderQueueList d_queues;
00348     RenderingWindowList d_windows;
00350     RenderTarget& d_target;
00352     bool d_invalidated;
00353 };
00354 
00355 } // End of  CEGUI namespace section
00356 
00357 #if defined(_MSC_VER)
00358 #   pragma warning(pop)
00359 #endif
00360 
00361 #endif  // end of guard _CEGUIRenderingSurface_h_