本文整理汇总了C++中ObjectRef::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectRef::Init方法的具体用法?C++ ObjectRef::Init怎么用?C++ ObjectRef::Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectRef
的用法示例。
在下文中一共展示了ObjectRef::Init方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
void Key::Init(TiXmlNode *node, CCSpriterX *animator)
{
TiXmlElement *element = node->ToElement();
if (element)
{
int intValue;
float floatValue;
if (element->QueryIntAttribute("id", &intValue) == TIXML_SUCCESS)
mId = intValue;
float time = 0;
if (element->QueryFloatAttribute("time", &floatValue) == TIXML_SUCCESS) // was in milliseconds, convert to seconds instead
time = floatValue/1000.0f;
mTime = time;
if (element->QueryIntAttribute("spin", &intValue) == TIXML_SUCCESS)
mSpinCounterClockwise = !(intValue == -1);
for (TiXmlNode* objNode = node->FirstChild(); objNode; objNode = objNode->NextSibling())
{
element = objNode->ToElement();
const char *tabObj = element->Value();
if (strcmp(tabObj, "object_ref")==0)
{
ObjectRef *ref = new ObjectRef();
ref->Init(objNode);
mObjectRefs.push_back(ref);
}
else if (strcmp(tabObj, "object")==0)
{
Object *obj = new Object();
obj->Init(objNode, animator);
mObjects.push_back(obj);
}
}
}
}