Game Development Reference
In-Depth Information
The following diagram shows an example of how an instance of WidgetClass
defined earlier in this chapter would be processed by the ITX parser:
For WidgetClass the only method we would definitely need to implement is the
ParseAttribute method, which might look like the following code:
bool WidgetClass::ParseAttribute(CIwTextParserITX* apParser,
const char* apAttribute)
{
if (!stricmp(apAttribute, "color"))
{
apParser->ReadUInt8Array(mColor, 3);
}
else if (!stricmp(apAttribute, "size"))
{
apParser->ReadInt32(&mSize);
}
else if (!stricmp(apAttribute, "sparkly"))
{
apParser->ReadBool(&mSparkly);
}
else if (!stricmp(apAttribute, "next"))
{
CIwStringL lNextWidget;
apParser->ReadString(lNextWidget);
mNextWidgetHash = IwHashString(lNextWidget.c_str());
}
 
Search WWH ::




Custom Search