当前位置: 首页>>代码示例>>C++>>正文


C++ CCNode::getAnchorPointInPoints方法代码示例

本文整理汇总了C++中CCNode::getAnchorPointInPoints方法的典型用法代码示例。如果您正苦于以下问题:C++ CCNode::getAnchorPointInPoints方法的具体用法?C++ CCNode::getAnchorPointInPoints怎么用?C++ CCNode::getAnchorPointInPoints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCNode的用法示例。


在下文中一共展示了CCNode::getAnchorPointInPoints方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: updateDisplay

void CCDisplayFactory::updateDisplay(CCBone *bone, float dt, bool dirty)
{
    CCNode *display = bone->getDisplayRenderNode();
    CS_RETURN_IF(!display);

    switch(bone->getDisplayRenderNodeType())
    {
    case CS_DISPLAY_SPRITE:
        if (dirty)
        {
            (static_cast<CCSkin*>(display))->updateArmatureTransform();
        }
        break;
    case CS_DISPLAY_PARTICLE:
        updateParticleDisplay(bone, display, dt);
        break;
    case CS_DISPLAY_ARMATURE:
        updateArmatureDisplay(bone, display, dt);
        break;
    default:
        display->setAdditionalTransform(bone->nodeToArmatureTransform());
        break;
    }

#if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT || ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX
    if (dirty)
    {
        CCDecorativeDisplay *decoDisplay = bone->getDisplayManager()->getCurrentDecorativeDisplay();
        CCColliderDetector *detector = decoDisplay->getColliderDetector();
        if (detector)
        {
            do
            {
#if ENABLE_PHYSICS_BOX2D_DETECT
                CC_BREAK_IF(!detector->getBody());
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
                CC_BREAK_IF(!detector->getBody());
#endif

                CCAffineTransform displayTransform = display->nodeToParentTransform();
                CCPoint anchorPoint =  display->getAnchorPointInPoints();
                anchorPoint = CCPointApplyAffineTransform(anchorPoint, displayTransform);
                displayTransform.tx = anchorPoint.x;
                displayTransform.ty = anchorPoint.y;
                CCAffineTransform t = CCAffineTransformConcat(displayTransform, bone->getArmature()->nodeToParentTransform());
                detector->updateTransform(t);
            }
            while (0);
        }
    }
#endif
}
开发者ID:,项目名称:,代码行数:52,代码来源:

示例2: updateDisplay

void CCDisplayFactory::updateDisplay(CCBone *bone, CCDecorativeDisplay *decoDisplay, float dt, bool dirty)
{
    CS_RETURN_IF(!decoDisplay);

#if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT
    if (dirty)
    {
        CCColliderDetector *detector = decoDisplay->getColliderDetector();
        if (detector)
        {
            do
            {
#if ENABLE_PHYSICS_BOX2D_DETECT
                CC_BREAK_IF(!detector->getBody());
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
                CC_BREAK_IF(!detector->getBody());
#endif
                CCNode *node = decoDisplay->getDisplay();
                CCAffineTransform displayTransform = node->nodeToParentTransform();
                CCPoint anchorPoint =  node->getAnchorPointInPoints();
                anchorPoint = CCPointApplyAffineTransform(anchorPoint, displayTransform);
                displayTransform.tx = anchorPoint.x;
                displayTransform.ty = anchorPoint.y;
                CCAffineTransform t = CCAffineTransformConcat(displayTransform, bone->getArmature()->nodeToParentTransform());
                detector->updateTransform(t);
            }
            while (0);
        }
    }
#endif

    CCNode *display = decoDisplay->getDisplay();

    switch(decoDisplay->getDisplayData()->displayType)
    {
    case CS_DISPLAY_SPRITE:
        updateSpriteDisplay(bone, display, dt, dirty);
        break;
    case CS_DISPLAY_PARTICLE:
        updateParticleDisplay(bone, display, dt, dirty);
        break;
    case CS_DISPLAY_ARMATURE:
        updateArmatureDisplay(bone, display, dt, dirty);
        break;
    default:
    {
        display->setAdditionalTransform(bone->nodeToArmatureTransform());
    }
    break;
    }
}
开发者ID:kundouzhishou,项目名称:tap4dream,代码行数:51,代码来源:CCDisplayFactory.cpp


注:本文中的CCNode::getAnchorPointInPoints方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。