3
Tuple2i textureGUIDimensions(256,256);
5
void GUITexCoordDescriptor::setTextureWidth(int width)
7
textureGUIDimensions.x = clamp(width, 8, 1024);
10
void GUITexCoordDescriptor::setTextureHeight(int height)
12
textureGUIDimensions.y = clamp(height, 8, 1024);
15
GUITexCoordDescriptor::GUITexCoordDescriptor(int widgetTypeArg)
17
texCoords.set(0.0f,0.0f,1.0f,1.0f);
18
widgetType = widgetTypeArg;
21
GUITexCoordDescriptor::GUITexCoordDescriptor(const GUITexCoordDescriptor ©)
23
this->operator=(copy);
26
GUITexCoordDescriptor &GUITexCoordDescriptor::operator =(const GUITexCoordDescriptor ©)
31
texCoords = copy.texCoords;
32
widgetType = copy.widgetType;
37
void GUITexCoordDescriptor::setType(int type)
44
case WT_CHECK_BOX_MARK:
46
case WT_CHECK_RB_MARK:
49
default: widgetType = WT_UNKNOWN;
53
void GUITexCoordDescriptor::setType(const std::string &type)
57
Logger::writeErrorLog("NULL GUITexCoordDescriptor type");
61
if(type == "MATERIAL_SURFACE"){ widgetType = WT_MATERIAL_SURFACE; return; }
62
if(type == "CHECK_BOX_MARK") { widgetType = WT_CHECK_BOX_MARK; return; }
63
if(type == "CHECK_RB_MARK") { widgetType = WT_CHECK_RB_MARK; return; }
64
if(type == "RADIO_BUTTON") { widgetType = WT_RADIO_BUTTON; return; }
65
if(type == "SEPARATOR") { widgetType = WT_SEPARATOR; return; }
66
if(type == "CHECK_BOX") { widgetType = WT_CHECK_BOX; return; }
67
if(type == "TEXT_AREA") { widgetType = WT_TEXT_AREA; return; }
68
if(type == "BUTTON") { widgetType = WT_BUTTON; return; }
69
if(type == "SLIDER") { widgetType = WT_SLIDER; return; }
70
if(type == "PANEL") { widgetType = WT_PANEL; return; }
71
if(type == "LABEL") { widgetType = WT_LABEL; return; }
73
Logger::writeErrorLog(std::string("Unknow GUITexCoordDescriptor type -> ") + type);
74
widgetType = WT_UNKNOWN;
77
int GUITexCoordDescriptor::getType()
82
void GUITexCoordDescriptor::loadXMLSettings(const TiXmlElement *element)
84
if(!XMLArbiter::inspectElementInfo(element, "TexCoordsDesc"))
93
xStart = XMLArbiter::fillComponents1i(element, "xStart", xStart);
94
yStart = XMLArbiter::fillComponents1i(element, "yStart", yStart);
96
xEnd = XMLArbiter::fillComponents1i(element, "xEnd", xEnd);
97
yEnd = XMLArbiter::fillComponents1i(element, "yEnd", yEnd);
99
setTexCoords(xStart/float(textureGUIDimensions.x), yStart/float(textureGUIDimensions.y),
100
xEnd /float(textureGUIDimensions.x), yEnd /float(textureGUIDimensions.y));
101
setType(element->Attribute("type"));
104
int GUITexCoordDescriptor::getTextureWidth()
106
return textureGUIDimensions.x;
109
int GUITexCoordDescriptor::getTextureHeight()
111
return textureGUIDimensions.y;
114
void GUITexCoordDescriptor::setTexCoords(float x, float y, float z, float w)
116
texCoords.set(clamp(x,0.0f, 1.0f), clamp(y,0.0f, 1.0f),
117
clamp(z,0.0f, 1.0f), clamp(w,0.0f, 1.0f));
120
void GUITexCoordDescriptor::setTexCoords(const Tuple4f& texCoordsArg)
122
texCoords = texCoordsArg;
125
const Tuple4f &GUITexCoordDescriptor::getTexCoords()