本文整理汇总了C++中CFrame::GetCollisionRect方法的典型用法代码示例。如果您正苦于以下问题:C++ CFrame::GetCollisionRect方法的具体用法?C++ CFrame::GetCollisionRect怎么用?C++ CFrame::GetCollisionRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFrame
的用法示例。
在下文中一共展示了CFrame::GetCollisionRect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//////////////////////////////////////////////////////////////
// GetCollisionRect
// - return the entity's bounding rectangle
/*virtual*/ RECT CEntity::GetCollisionRect( void ) const
{
CFrame* currFrame = m_pAM->GetCurrentFrame(m_pAnimInfo);
RECT rCollision = currFrame->GetCollisionRect().GetRECT();
if (m_bFlipped == true)
{
// Get the width of the collision rect before flipping
int width = (rCollision.right - rCollision.left);
// Get the offset from the anchor point to the top left of the collision rect
tVector2D offset = { (float)(rCollision.left), (float)(rCollision.top ) };
// Negate the anchor point x value
rCollision.left = (LONG)(-offset.fX);
rCollision.right = (LONG)(-offset.fX);
// Subtract the width of the collision rect
rCollision.left -= width;
}
// Add the position of the character in the world to the collision rect
rCollision.left += (int)(m_fPosX - m_pGC->GetPosX());
rCollision.right += (int)(m_fPosX - m_pGC->GetPosX());
rCollision.top += (int)(m_fPosY - m_pGC->GetPosY());
rCollision.bottom += (int)(m_fPosY - m_pGC->GetPosY());
return rCollision;
}