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


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

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


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

示例1: getRelativeRect

CCRect UIWidget::getRelativeRect()
{
    CCNode* validNode = getValidNode();
    float width = 0.0f;
    float height = 0.0f;
    float anchorPointX = 0.0f;
    float anchorPointY = 0.0f;
    CCSize nodeSize = validNode->getContentSize();
    width = nodeSize.width*getScaleX();
    height = nodeSize.height*getScaleY();
    CCPoint nodeAnchorPoint = validNode->getAnchorPoint();
    anchorPointX = nodeAnchorPoint.x;
    anchorPointY = nodeAnchorPoint.y;
    switch (m_WidgetType)
    {
        case WidgetTypeWidget:
            m_relativeRect.origin.x = getPosition().x - width * anchorPointX;
            m_relativeRect.origin.y = getPosition().y - height * anchorPointY;
            break;
        case WidgetTypeContainer:
            m_relativeRect.origin.x = getPosition().x;
            m_relativeRect.origin.y = getPosition().y;
            break;
    }
    m_relativeRect.size.width = width;
    m_relativeRect.size.height = height;
    return m_relativeRect;
}
开发者ID:chenxu111,项目名称:Cocos2d-x-For-CocoStudio,代码行数:28,代码来源:UIWidget.cpp

示例2: relayoutAsVertical

void HRootLayer::relayoutAsVertical(CCArray *nodes, CCPoint basePos, int interval) {
    for (int i = 0; i < nodes->count(); ++i) {
        CCNode *node = (CCNode *)nodes->objectAtIndex(i);
        node->setPosition(CCPointMake(basePos.x, basePos.y + node->getAnchorPoint().y * node->getContentSize().height));
        basePos.y += node->getContentSize().height + interval;
    }
}
开发者ID:hyizsg,项目名称:mytest1st,代码行数:7,代码来源:RootLayer.cpp

示例3: relayoutAsHorizontal

void HRootLayer::relayoutAsHorizontal(CCArray *nodes, CCPoint basePos, int interval) {
    for (int i = 0; i < nodes->count(); ++i) {
        CCNode *node = (CCNode *)nodes->objectAtIndex(i);
        node->setPosition(CCPointMake(basePos.x + node->getAnchorPoint().x * node->getContentSize().width * node->getScaleX(), basePos.y));
        basePos.x += node->getContentSize().width * node->getScaleX() + interval;
    }
}
开发者ID:hyizsg,项目名称:mytest1st,代码行数:7,代码来源:RootLayer.cpp

示例4: visit

void CCBClippingNode::visit(){
    
    CCNode* hock = this->getChildByTag(htag);
    if (hock==NULL) {
        getStencil()->setPosition(0, 0);
        getStencil()->setScaleX(1);
        getStencil()->setScaleY(1);
        getStencil()->setRotationX(0);
        getStencil()->setRotationY(0);
        getStencil()->setSkewX(0);
        getStencil()->setSkewY(0);
        getStencil()->setAnchorPoint(ccp(0.5, 0.5));
    }else{
        getStencil()->setPosition(hock->getPositionX(),hock->getPositionY());
        getStencil()->setScaleX(hock->getScaleX());
        getStencil()->setScaleY(hock->getScaleY());
        getStencil()->setRotationX(hock->getRotationX());
        getStencil()->setRotationY(hock->getRotationY());
        getStencil()->setSkewX(hock->getSkewX());
        getStencil()->setSkewY(hock->getSkewY());
        getStencil()->setAnchorPoint(hock->getAnchorPoint());
    }
    
    CCClippingNode::visit();
}
开发者ID:royhu,项目名称:CCBReader-X,代码行数:25,代码来源:CCBClippingNode.cpp

示例5:

void E002_C010_P230::_setPositionOutParent(CCNode* child, CCNode* newParent)
{
    CCNode* parent = (CCNode*)child->getParent();
    if (parent && child) {
    
        child->retain();
        
        CCSize parentSize = parent->getContentSize();
        CCPoint parentAnchor = parent->getAnchorPoint();
        
        float posX =  parent->getPositionX() - parentSize.width*parentAnchor.x + child->getPositionX();
        float posY =  parent->getPositionY() - parentSize.height*parentAnchor.y + child->getPositionY();
    
        child->removeFromParentAndCleanup(false);
        child->setPosition(ccp(posX, posY));
        this->addChild(child);
        
        child->release();
    }
    
}
开发者ID:JeonJonguk,项目名称:e002_c010,代码行数:21,代码来源:E002_C010_P230.cpp


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