本文整理汇总了C++中CFrame::SetWeaponCollisionRect方法的典型用法代码示例。如果您正苦于以下问题:C++ CFrame::SetWeaponCollisionRect方法的具体用法?C++ CFrame::SetWeaponCollisionRect怎么用?C++ CFrame::SetWeaponCollisionRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFrame
的用法示例。
在下文中一共展示了CFrame::SetWeaponCollisionRect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadAnimation
//.........这里部分代码省略.........
tempFrame.SetDrawRect(tempDrawRect);
// Get the collsion Rect
TiXmlElement* pCollisionRect = pDrawRect->NextSiblingElement("CollisionRect");
RectD tempCollisionRect;
if(pCollisionRect->QueryIntAttribute("x",&nTemp) != TIXML_NO_ATTRIBUTE)
{
tempCollisionRect.left = nTemp;
}
if(pCollisionRect->QueryIntAttribute("y",&nTemp) != TIXML_NO_ATTRIBUTE)
{
tempCollisionRect.top = nTemp;
}
if(pCollisionRect->QueryIntAttribute("width",&nTemp) != TIXML_NO_ATTRIBUTE)
{
tempCollisionRect.right = tempCollisionRect.left + nTemp;
tempCollisionRect.width = nTemp;
}
if(pCollisionRect->QueryIntAttribute("height",&nTemp) != TIXML_NO_ATTRIBUTE)
{
tempCollisionRect.bottom = tempCollisionRect.top + nTemp;
tempCollisionRect.height = nTemp;
}
// Set the collision Rect
tempFrame.SetCollisionRect(tempCollisionRect);
// Get the anchor
TiXmlElement* pAnchor = pDrawRect->NextSiblingElement("Anchor");
Point tempAnchor;
if(pAnchor->QueryIntAttribute("x",&nTemp) != TIXML_NO_ATTRIBUTE)
{
tempAnchor.x = nTemp;
}
if(pAnchor->QueryIntAttribute("y",&nTemp) != TIXML_NO_ATTRIBUTE)
{
tempAnchor.y = nTemp;
}
tempFrame.SetAnchorPoint(tempAnchor);
TiXmlElement* pWeapon = pAnchor->NextSiblingElement("WeaponCollisionRect");
RectD tempWeaponCollisionRect;
if(pWeapon->QueryIntAttribute("x",&nTemp) != TIXML_NO_ATTRIBUTE)
{
tempWeaponCollisionRect.left = nTemp;
}
if(pWeapon->QueryIntAttribute("y",&nTemp) != TIXML_NO_ATTRIBUTE)
{
tempWeaponCollisionRect.top = nTemp;
}
if(pWeapon->QueryIntAttribute("width",&nTemp) != TIXML_NO_ATTRIBUTE)
{
tempWeaponCollisionRect.right = tempWeaponCollisionRect.left + nTemp;
}
if(pWeapon->QueryIntAttribute("height",&nTemp) != TIXML_NO_ATTRIBUTE)
{
tempWeaponCollisionRect.bottom = tempWeaponCollisionRect.top + nTemp;
}
tempFrame.SetWeaponCollisionRect(tempWeaponCollisionRect);
//Point tempWeaponAnchor;
//if(pWeapon->QueryIntAttribute("x",&nTemp) != TIXML_NO_ATTRIBUTE)
//{
// tempWeaponAnchor.x = nTemp;
//}
//if(pWeapon->QueryIntAttribute("y",&nTemp) != TIXML_NO_ATTRIBUTE)
//{
// tempWeaponAnchor.y = nTemp;
//}
//tempFrame.SetWeaponAnchorPoint(tempWeaponAnchor);
//float tempWeaponAngle;
//if(pWeapon->QueryDoubleAttribute("angle",&dTemp) != TIXML_NO_ATTRIBUTE)
//{
// tempWeaponAngle = dTemp;
//}
//tempFrame.SetWeaponAngle(tempWeaponAngle);
tempAnimation->GetFrames()->push_back(tempFrame);
pFrame = pFrame->NextSiblingElement("Frame");
}
tempAnimation->SetImageId(nAnimationSheet);
m_Animations.push_back(tempAnimation);
// Set the right values to be returned
if(pnFirstAnmID)
{
if(*pnFirstAnmID == -1)
*pnFirstAnmID = m_Animations.size() - 1;
}
if(pnLastAnmID)
{
*pnLastAnmID = m_Animations.size() - 1;
}
pAnimation = pAnimation->NextSiblingElement("Animation");
}
return 0;
}