00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "falagard/CEGUIFalStateImagery.h"
00025 #include "CEGUISystem.h"
00026 #include "CEGUIRenderer.h"
00027 #include <iostream>
00028
00029
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
00042 for(LayersList::const_iterator curr = d_layers.begin(); curr != d_layers.end(); ++curr)
00043 {
00044
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
00055 for(LayersList::const_iterator curr = d_layers.begin(); curr != d_layers.end(); ++curr)
00056 {
00057
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
00104 for(LayersList::const_iterator curr = d_layers.begin(); curr != d_layers.end(); ++curr)
00105 (*curr).writeXMLToStream(out_stream);
00106
00107
00108 out_stream << "</StateImagery>" << std::endl;
00109 }
00110 }
00111
00112 }