本文整理汇总了C++中Folder::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ Folder::Init方法的具体用法?C++ Folder::Init怎么用?C++ Folder::Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Folder
的用法示例。
在下文中一共展示了Folder::Init方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initWithFile
bool CCSpriterX::initWithFile(const char *filename)
{
mCurrEntity = 0;
unsigned long filesize;
const char *path = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(filename);
char *buffer = (char *)CCFileUtils::sharedFileUtils()->getFileData(path, "rb", &filesize);
if (buffer == NULL)
return false;
TiXmlDocument doc;
doc.Parse(buffer);
TiXmlNode *root = doc.FirstChild("spriter_data");
if (root)
{
TiXmlElement *element = root->ToElement();
const char *version = element->Attribute("scml_version");
const char *generator = element->Attribute("generator");
const char *generatorVersion = element->Attribute("generator_version");
for (TiXmlNode* entityNode = root->FirstChild(); entityNode; entityNode = entityNode->NextSibling())
{
element = entityNode->ToElement();
if (element)
{
const char *tab = element->Value();
if (strcmp(tab, "folder")==0)
{
Folder *folder = new Folder();
folder->Init(entityNode);
mFolders.push_back(folder);
}
else if (strcmp(tab, "entity")==0)
{
int intValue;
Entity *entity = new Entity();
if (element->QueryIntAttribute("id", &intValue) == TIXML_SUCCESS)
entity->SetId(intValue);
entity->SetName(element->Attribute("name"));
for (TiXmlNode* animationNode = entityNode->FirstChild(); animationNode; animationNode = animationNode->NextSibling())
{
Animation *animation = new Animation();
animation->Init(animationNode, this);
entity->AddAnimation(animation);
}
mEntities.push_back(entity);
}
}
}
}
CC_SAFE_DELETE_ARRAY(buffer);
this->scheduleUpdate();
return true;
}