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


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

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


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

示例1: restoreAllPriorities

CCObject *HTouchEnabledLayerColor::dismissNodeEx(int command, HEndDismissNode *notify) {
    CCNode *node = notify->getNode();
    do {
        if (node->getParent() != this) break;
        HBakNodeInfo *info = NULL;
        for (int i = m_pBakNodeList->count() - 1; i >= 0; --i) {
            info = (HBakNodeInfo *)m_pBakNodeList->objectAtIndex(i);
            if (node == info->m_pNode) {
                break;
            }
            info = NULL;
        }
        if (!info) break;
        
        node->retain();
        node->removeFromParentAndCleanup(false);
        info->m_pParent->addChild(node, info->m_iIndex);
        node->setScaleX(info->m_fScaleX);
        node->setScaleY(info->m_fScaleY);
        node->setPosition(info->m_ptPos);
        node->release();
        
        restoreAllPriorities(info);
        m_pBakNodeList->removeObject(info);
    } while (false);
    if (notify->getTarget() && notify->getAction()) {
        (notify->getTarget()->*notify->getAction())(node);
    }
    return NULL;
}
开发者ID:hyizsg,项目名称:mytest1st,代码行数:30,代码来源:RootLayer.cpp

示例2: doCCTouchBegan

bool IBBTouchElement::doCCTouchBegan(cocos2d::CCTouch *pTouch, cocos2d::CCEvent *pEvent)
{
	if(m_touchListeners->count() == 0) return false;
	bool result = false;
	
	pTouch->retain();
	
	CCPoint pos = pTouch->getLocationInView();
	pos = CCDirector::sharedDirector()->convertToGL(pos);
	
	CCObject* it = NULL;
	
	CCARRAY_FOREACH(m_touchListeners, it)
	{
		CCNode* node = dynamic_cast<CCNode*>(it);
		
		node->retain();
		
		if(BBTouchEventUtils::hitTest(node, pTouch))
		{
						
			result = m_blockTouchFlow;
					
			onTouchPress(node, pTouch);
			BBTouchEventUtils::press(node, pos);
		}
	}
开发者ID:newcl,项目名称:boom,代码行数:27,代码来源:IBBTouchElement.cpp

示例3: viewTabIndex

CCNode* ActorBoardLayer::viewTabIndex(CCNode* pTabLayer,int index)
{
    CCNode* node = NULL;
    switch (index) {
        case 0:
        {
          //  node = BagLayer::create();
            CCSize winsize = CCDirector::sharedDirector()->getWinSize();
            ClothesLayer* layer1 = ClothesLayer::create();
            BagLayer* layer2 = BagLayer::create();
            node = CCNode::create();
          
            node->addChild(layer1);
            layer1->setAnchorPoint(ccp(0,0));
            layer1->setPosition(ccp(50, winsize.height/3));
            node->addChild(layer2);
            
            layer2->setPosition(layer1->boundingBox().size.width+150,0);
 
            
        }
            break;
        case 1:
            node = CCLabelTTF::create(
                         "1 page", "Arial", 22);
            break;
        case 2:
            node = CCLabelTTF::create(
                                      "2 page", "Arial", 22);
            break;
        case 3:
            node = CCLabelTTF::create(
                                      "3 page", "Arial", 22);
            break;
        default:
            node = CCLabelTTF::create(
                                      "no page", "Arial", 22);
            break;
    }
    node->retain();
    return node;
}
开发者ID:9cat,项目名称:dotawar,代码行数:42,代码来源:ActorBoardLayer.cpp

示例4: ccTouchBegan

bool CCScene::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{
    CC_SAFE_RELEASE_NULL(m_touchNode);
    const CCPoint p = pTouch->getLocation();
    CCObject *node;
    CCNode *touchNode = NULL;
    CCNode *checkNode = NULL;
    bool visible = true;
    sortAllTouchableNodes();
    CCARRAY_FOREACH(m_touchableNodes, node)
    {
        checkNode = touchNode = dynamic_cast<CCNode*>(node);

        // check node is visible
        visible = true;
        do
        {
            visible = visible && checkNode->isVisible();
            checkNode = checkNode->getParent();
        } while (checkNode && visible);
        if (!visible) continue;

        const CCRect boundingBox = touchNode->getCascadeBoundingBox();
        if (boundingBox.containsPoint(p))
        {
            touchNode->retain();
            bool ret = touchNode->ccTouchBegan(pTouch, pEvent);
            if (ret && touchNode->isRunning())
            {
                m_touchNode = touchNode;
                m_touchNode->retain();
            }
            touchNode->release();
            if (ret) return true;
        }
    }
开发者ID:SD216814,项目名称:quick-cocos2d-x,代码行数:36,代码来源:CCScene.cpp


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