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


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

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


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

示例1: updateShowArea

void CHandBookPanel::updateShowArea()
{
	CCNode* pLayer = m_ui;

	if(m_pHeroLayer) m_pHeroLayer->setVisible(false);
	if(m_pMonsterLayer) m_pMonsterLayer->setVisible(false);
	if(m_pEquipLayer)m_pEquipLayer->setVisible(false);

	switch (m_iType)
	{
	case HandBookTabHero:
		{
			if(!m_pHeroLayer)
			{
				m_pHeroLayer = CHandBookHeroLayer::create();
				m_pHeroLayer->setTouchPriority(LayerManager::instance()->getPriority()-1);
				pLayer->addChild(m_pHeroLayer);
				m_pHeroLayer->setPosition(pLayer->convertToNodeSpace(m_pHeroLayer->getPosition()));
				AskForHandBook(m_iType);
			}
			else
			{
				m_pHeroLayer->setVisible(true);
			}
		}
		break;
	case HandBookTabMonster:
		{
			if(!m_pMonsterLayer)
			{
				m_pMonsterLayer = CHandBookMonsterLayer::create();
				m_pMonsterLayer->setTouchPriority(LayerManager::instance()->getPriority()-1);
				pLayer->addChild(m_pMonsterLayer);
				m_pMonsterLayer->setPosition(pLayer->convertToNodeSpace(m_pMonsterLayer->getPosition()));
				AskForHandBook(m_iType);
			}
			m_pMonsterLayer->setVisible(true);
		}
		break;
	case HandBookTabEquip:
		{
			if(!m_pEquipLayer)
			{
				m_pEquipLayer = CHandBookEquipLayer::create();
				m_pEquipLayer->setTouchPriority(LayerManager::instance()->getPriority()-1);
				pLayer->addChild(m_pEquipLayer);
				m_pEquipLayer->setPosition(pLayer->convertToNodeSpace(m_pEquipLayer->getPosition()));
				AskForHandBook(m_iType);
			}
			m_pEquipLayer->setVisible(true);
		}
		break;
	case HandBookTabMax:
		break;
	default:
		break;
	}
}
开发者ID:54993306,项目名称:Classes,代码行数:58,代码来源:HandBookPanel.cpp

示例2: ccTouchesBegan

void ScrollViewDemo::ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent)
{
	CCTouch *touch = (CCTouch*)pTouches->anyObject();
    CCNode *clipper = this->getChildByTag(kTagClipperNode);
	CCPoint point = clipper->convertToNodeSpace(CCDirector::sharedDirector()->convertToGL(touch->getLocationInView()));
    CCRect rect = CCRectMake(0, 0, clipper->getContentSize().width, clipper->getContentSize().height);
    m_bScrolling = rect.containsPoint(point);
    m_lastPoint = point;
}
开发者ID:1901,项目名称:cocos2d-x,代码行数:9,代码来源:ClippingNodeTest.cpp

示例3: ccTouchesMoved

void ScrollViewDemo::ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent)
{
    if (!m_bScrolling) return;
	CCTouch *touch = (CCTouch*)pTouches->anyObject();
    CCNode *clipper = this->getChildByTag(kTagClipperNode);
    CCPoint point = clipper->convertToNodeSpace(CCDirector::sharedDirector()->convertToGL(touch->getLocationInView()));
	CCPoint diff = ccpSub(point, m_lastPoint);
    CCNode *content = clipper->getChildByTag(kTagContentNode);
    content->setPosition( ccpAdd(content->getPosition(), diff) );
    m_lastPoint = point;
}
开发者ID:1901,项目名称:cocos2d-x,代码行数:11,代码来源:ClippingNodeTest.cpp

示例4: isTouchInside

bool CCtrlPage::isTouchInside( cocos2d::CCTouch * touch )
{
	CCNode* pParent = this->getParent();
	if (NULL == pParent)
	{
		return false;
	}

	CHECKF(touch);
	CCPoint touchLocation = touch->getLocation(); // Get the touch position
	touchLocation = pParent->convertToNodeSpace(touchLocation);
	CCRect bBox=boundingBox();
	return bBox.containsPoint(touchLocation);
}
开发者ID:twkevin,项目名称:ddz,代码行数:14,代码来源:CtrlPage.cpp

示例5: setWorldPos

void Character::setWorldPos(CCPoint posInWorld)
{
    if(m_bodyArray.size() == 0)
        return ;
    b2Body* pBody = m_bodyArray[0];
    if(!pBody)
        return;
    pBody->SetTransform(b2Vec2(posInWorld.x/PTM_RATIO,posInWorld.y/PTM_RATIO), 0);
    CCSprite* pSprite =  (CCSprite*)pBody->GetUserData();
    if(!pSprite)
        return ;
    CCNode* pParent =pSprite->getParent();
    if(!pParent)
        return;
    CCPoint point = pParent->convertToNodeSpace(CCPointMake( posInWorld.x/PTM_RATIO,posInWorld.y/PTM_RATIO));
    pSprite->setPosition(point);
}
开发者ID:bingwan,项目名称:Cut2.1.2Classes,代码行数:17,代码来源:Character.cpp

示例6: ccTouchesended

void ConvertToNode::ccTouchesended(CCSet* touches, CCEvent *event)
{
    for( CCSetIterator it = touches->begin(); it != touches->end(); ++it)
    {
        CCTouch* touch = (CCTouch*)(*it);
        CCPoint location = touch->getLocation();

        for( int i = 0; i < 3; i++)
        {
            CCNode *node = getChildByTag(100+i);
            CCPoint p1, p2;

            p1 = node->convertToNodeSpaceAR(location);
            p2 = node->convertToNodeSpace(location);

            CCLOG("AR: x=%.2f, y=%.2f -- Not AR: x=%.2f, y=%.2f", p1.x, p1.y, p2.x, p2.y);
        }
    }    
}
开发者ID:HongXiao,项目名称:Client-source,代码行数:19,代码来源:NodeTest.cpp


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