本文整理汇总了C++中Sprite::GetSpriteID方法的典型用法代码示例。如果您正苦于以下问题:C++ Sprite::GetSpriteID方法的具体用法?C++ Sprite::GetSpriteID怎么用?C++ Sprite::GetSpriteID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sprite
的用法示例。
在下文中一共展示了Sprite::GetSpriteID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadSprites
//.........这里部分代码省略.........
spriteImg = spriteImg->NextSiblingElement("isLooping");
if (spriteImg != nullptr)
{
int boolNum;
spriteImg->Attribute("isIt", &boolNum);
if (boolNum == 0)
newSprite->SetLooping(false);
else
newSprite->SetLooping(true);
}
spriteImg = spriteImg->NextSiblingElement("Frames");
int numFrames;
if (spriteImg != nullptr)
{
spriteImg->Attribute("numbers", &numFrames);
}
TiXmlElement* frames = spriteImg->NextSiblingElement("frame");
for (int i = 0; i < numFrames; i++)
{
if (frames != nullptr)
{
TiXmlElement* info = frames->FirstChildElement("anchorPoint");
Frame* newFrame = new Frame();
if (info != nullptr)
{
SGD::Point pointTemp;
double x, y;
info->Attribute("X", &x);
pointTemp.x = (float)x;
info->Attribute("Y", &y);
pointTemp.y = (float)y;
newFrame->SetAnchorPoint(pointTemp);
}
info = info->NextSiblingElement("collisionRect");
if (info != nullptr)
{
SGD::Rectangle collTemp;
double l, t, r, b;
info->Attribute("left", &l);
collTemp.left = (float)l;
info->Attribute("right", &r);
collTemp.right = (float)r;
info->Attribute("top", &t);
collTemp.top = (float)t;
info->Attribute("bottom", &b);
collTemp.bottom = (float)b;
newFrame->SetCollisionRect(collTemp);
}
info = info->NextSiblingElement("drawRect");
if (info != nullptr)
{
SGD::Rectangle drawTemp;
double l, t, r, b;
info->Attribute("left", &l);
drawTemp.left = (float)l;
info->Attribute("right", &r);
drawTemp.right = (float)r;
info->Attribute("top", &t);
drawTemp.top = (float)t;
info->Attribute("bottom", &b);
drawTemp.bottom = (float)b;
newFrame->SetFrameRect(drawTemp);
}
info = info->NextSiblingElement("duration");
if (info != nullptr)
{
double durtemp;
info->Attribute("time", &durtemp);
newFrame->SetDuration((float)durtemp);
}
info = info->NextSiblingElement("triggerID");
if (info != nullptr)
{
std::string trigid = info->GetText();
if (trigid.c_str() != nullptr)
newFrame->SetTriggerID(trigid);
}
newSprite->AddFrame(newFrame);
//frames->
frames = frames->NextSiblingElement("frame");
}
}
m_mSprites[newSprite->GetSpriteID()] = newSprite;
m_vSpriteNames.push_back(newSprite->GetSpriteID());
spriteImg = spriteImg->NextSiblingElement("sprite");
}
}
if (m_mSprites.size() > 0)
return ID;
else
return nullptr;
}