Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CEGUIFalStateImagery.cpp

Go to the documentation of this file.
00001 /************************************************************************
00002     filename:   CEGUIFalStateImagery.cpp
00003     created:    Mon Jun 13 2005
00004     author:     Paul D Turner <paul@cegui.org.uk>
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 #include "falagard/CEGUIFalStateImagery.h"
00025 #include "CEGUISystem.h"
00026 #include "CEGUIRenderer.h"
00027 #include <iostream>
00028 
00029 // Start of CEGUI namespace section
00030 namespace CEGUI
00031 {
00032     StateImagery::StateImagery(const String& name) :
00033         d_stateName(name),
00034         d_clipToDisplay(false)
00035     {}
00036 
00037     void StateImagery::render(Window& srcWindow, const ColourRect* modcols, const Rect* clipper) const
00038     {
00039         float base_z;
00040 
00041         // render all layers defined for this state
00042         for(LayersList::const_iterator curr = d_layers.begin(); curr != d_layers.end(); ++curr)
00043         {
00044             // TODO: Magic number removal
00045             base_z = -0.0000001f * static_cast<float>((*curr).getLayerPriority());
00046             (*curr).render(srcWindow, base_z, modcols, clipper, d_clipToDisplay);
00047         }
00048     }
00049 
00050     void StateImagery::render(Window& srcWindow, const Rect& baseRect, const ColourRect* modcols, const Rect* clipper) const
00051     {
00052         float base_z;
00053 
00054         // render all layers defined for this state
00055         for(LayersList::const_iterator curr = d_layers.begin(); curr != d_layers.end(); ++curr)
00056         {
00057             // TODO: Magic number removal
00058             base_z = -0.0000001f * static_cast<float>((*curr).getLayerPriority());
00059             (*curr).render(srcWindow, baseRect, base_z, modcols, clipper, d_clipToDisplay);
00060         }
00061     }
00062 
00063     void StateImagery::addLayer(const LayerSpecification& layer)
00064     {
00065         d_layers.insert(layer);
00066     }
00067 
00068     void StateImagery::clearLayers()
00069     {
00070         d_layers.clear();
00071     }
00072 
00073     const String& StateImagery::getName() const
00074     {
00075         return d_stateName;
00076     }
00077 
00078     bool StateImagery::isClippedToDisplay() const
00079     {
00080         return d_clipToDisplay;
00081     }
00082 
00083     void StateImagery::setClippedToDisplay(bool setting)
00084     {
00085         d_clipToDisplay = setting;
00086     }
00087 
00088     void StateImagery::writeXMLToStream(OutStream& out_stream) const
00089     {
00090         out_stream << "<StateImagery name=\"" << d_stateName << "\"";
00091 
00092         if (d_clipToDisplay)
00093             out_stream << " clipped=\"false\"";
00094 
00095         if (d_layers.empty())
00096         {
00097             out_stream << " />" << std::endl;
00098         }
00099         else
00100         {
00101             out_stream << ">" << std::endl;
00102 
00103             // output all layers defined for this state
00104             for(LayersList::const_iterator curr = d_layers.begin(); curr != d_layers.end(); ++curr)
00105                 (*curr).writeXMLToStream(out_stream);
00106 
00107             // write closing </StateImagery> tag
00108             out_stream << "</StateImagery>" << std::endl;
00109         }
00110     }
00111 
00112 } // End of  CEGUI namespace section

Generated on Wed Sep 7 09:56:31 2005 for Crazy Eddies GUI System by  doxygen 1.4.3