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


C++ CCSet类代码示例

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


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

示例1: ccTouchBegan

bool ScrollMenu::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{
    CCSet set;
    set.addObject(pTouch);
    scrollView->ccTouchesBegan(&set, pEvent);
    return true;
}
开发者ID:13609594236,项目名称:ph-open,代码行数:7,代码来源:PageScrollView.cpp

示例2: setIndentLevel

void CCPrettyPrinter::visit(const CCSet *p)
{
    _result += "\n";
    _result += _indentStr;
    _result += "<set>\n";
    
    setIndentLevel(_indentLevel+1);

    int i = 0;
    CCSet* tmp = const_cast<CCSet*>(p);
    CCSetIterator it = tmp->begin();

    for (; it != tmp->end(); ++it, ++i) {
        if (i > 0) {
            _result += "\n";
        }
        _result += _indentStr.c_str();
        CCPrettyPrinter v(_indentLevel);
        (*it)->acceptVisitor(v);
        _result += v.getResult();
    }
    setIndentLevel(_indentLevel-1);
    
    _result += "\n";
    _result += _indentStr;
    _result += "</set>\n";
}
开发者ID:weimingtom,项目名称:guichan_cocos2dx,代码行数:27,代码来源:CCDataVisitor.cpp

示例3: OnPenUp

Boolean CCEGLView::OnPenUp(EventType* pEvent, Int32 nIndex)
{
    if (m_pDelegate && nIndex < MAX_TOUCHES)
    {
        CCTouch* pTouch = s_pTouches[nIndex];
        if (pTouch)
        {
            CCSet set;
            pTouch->SetTouchInfo(0, (float)pEvent->sParam1, (float)pEvent->sParam2);
            set.addObject(pTouch);
            m_pDelegate->touchesEnded(&set, NULL);

            pTouch->release();
            for (Int32 i = nIndex; i < MAX_TOUCHES; ++i)
            {
                if (i != (MAX_TOUCHES - 1))
                {
                    s_pTouches[i] = s_pTouches[i + 1];
                }
                else
                {
                    s_pTouches[i] = NULL;
                }
            }
        }
    }

    return FALSE;
}
开发者ID:BigHand,项目名称:cocos2d-x,代码行数:29,代码来源:CCEGLView_uphone.cpp

示例4: CCTouch

void CCEGLView::OnPointerPressed(int id, const CCPoint& point)
{
    // prepare CCTouch
    CCTouch* pTouch = m_pTouches[id];
    if (! pTouch)
    {
        pTouch = new CCTouch();
        m_pTouches[id] = pTouch;
    }

    // prepare CCSet
    CCSet* pSet = m_pSets[id];
    if (! pSet)
    {
        pSet = new CCSet();
        m_pSets[id] = pSet;
    }

    if (! pTouch || ! pSet)
        return;

    float x = point.x;
    float y = point.y;
    ConvertPointerCoords(x, y);
    pTouch->SetTouchInfo(x, y);
    pSet->addObject(pTouch);

    m_pDelegate->touchesBegan(pSet, NULL);
}
开发者ID:9miao,项目名称:cocos2dx-win8,代码行数:29,代码来源:CCEGLView_win8_metro.cpp

示例5: onTouchesMove

void CCEGLView::onTouchesMove(int id[], float x[], float y[], int pointerNumber)
{
	result r = E_SUCCESS;
	CCSet set;
	for(int i = 0 ; i < pointerNumber ; i++ ) {
		CCLOG("Moving touches with id: %d, x=%f, y=%f", id[i], x[i], y[i]);
		CCTouch *pTouch = NULL;
		r = s_mapTouches.GetValue(id[i], pTouch);

		if (E_SUCCESS == r && pTouch != NULL)
		{
			pTouch->SetTouchInfo(0, (x[i] - m_rcViewPort.origin.x) / m_fScreenScaleFactor ,
								(y[i] - m_rcViewPort.origin.y) / m_fScreenScaleFactor);
			set.addObject(pTouch);
		}
		else
		{
			// It is error, should return.
			CCLOG("Moving touches with id: %d error", id[i]);
			return;
		}
	}

	m_pDelegate->touchesMoved(&set, NULL);
}
开发者ID:Avnerus,项目名称:ichigo,代码行数:25,代码来源:CCEGLView_bada.cpp

示例6: Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesCancel

	void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesCancel(JNIEnv*  env, jobject thiz, jintArray ids, jfloatArray xs, jfloatArray ys)
	{
		int size = env->GetArrayLength(ids);
		jint id[size];
		jfloat x[size];
		jfloat y[size];
		CCRect rcRect = CCEGLView::sharedOpenGLView().getViewPort();
		CCSet set;

		env->GetIntArrayRegion(ids, 0, size, id);
		env->GetFloatArrayRegion(xs, 0, size, x);
		env->GetFloatArrayRegion(ys, 0, size, y);

		for( int i = 0 ; i < size ; i++ ) {
			cocos2d::CCTouch* pTouch = s_pTouches[id[i]];
			if (pTouch)
			{
				pTouch->SetTouchInfo(0, x[i] - rcRect.origin.x, 
			                        y[i] - rcRect.origin.y, id[i]);
				set.addObject(pTouch);
				s_pTouches[id[i]] = NULL;
				pTouch->release();
			}
		}

		cocos2d::CCDirector::sharedDirector()->getOpenGLView()->getDelegate()->touchesCancelled(&set, NULL);
	}
开发者ID:authorly,项目名称:interapptive,代码行数:27,代码来源:TouchesJni.cpp

示例7: Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesMove

	void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesMove(JNIEnv*  env, jobject thiz, jintArray ids, jfloatArray xs, jfloatArray ys)
	{
		int size = env->GetArrayLength(ids);
		jint id[size];
		jfloat x[size];
		jfloat y[size];
		CCRect rcRect = CCEGLView::sharedOpenGLView().getViewPort();
		CCSet set;

		env->GetIntArrayRegion(ids, 0, size, id);
		env->GetFloatArrayRegion(xs, 0, size, x);
		env->GetFloatArrayRegion(ys, 0, size, y);

		for( int i = 0 ; i < size ; i++ ) {
			LOGD("Moving touches with id: %d, x=%f, y=%f", id[i], x[i], y[i]);
			cocos2d::CCTouch* pTouch = s_pTouches[id[i]];
			if (pTouch)
			{
				pTouch->SetTouchInfo(0, x[i] - rcRect.origin.x , 
			                        y[i] - rcRect.origin.y, id[i]);
				set.addObject(pTouch);
			}
			else
			{
				// It is error, should return.
				LOGD("Moving touches with id: %d error", id[i]);
				return;
			}
		}
		
		cocos2d::CCDirector::sharedDirector()->getOpenGLView()->getDelegate()->touchesMoved(&set, NULL);
	}
开发者ID:authorly,项目名称:interapptive,代码行数:32,代码来源:TouchesJni.cpp

示例8: CC_BREAK_IF

Boolean CCEGLView::OnPenMove(EventType* pEvent)
{
    do 
    {
        CC_BREAK_IF(!m_pDelegate);

        Int32 nCount = EvtGetPenMultiPointCount(pEvent);
        CC_BREAK_IF(nCount <= 0 || nCount > MAX_TOUCHES);

        CCSet set;
        Int32 nPosX, nPosY;
        for (Int32 i = 0; i < nCount; ++i)
        {
            CCTouch* pTouch = s_pTouches[i];
            CC_BREAK_IF(!pTouch);

            EvtGetPenMultiPointXY(pEvent, i, &nPosX, &nPosY);
            pTouch->SetTouchInfo(0, (float) nPosX, (float) nPosY);
            set.addObject(pTouch);
        }

        m_pDelegate->touchesMoved(&set, NULL);
    } while (0);

    return FALSE;
}
开发者ID:BigHand,项目名称:cocos2d-x,代码行数:26,代码来源:CCEGLView_uphone.cpp

示例9: handleTouchesBegin

void CCEGLViewProtocol::handleTouchesBegin(int num, int ids[], float xs[],
										   float ys[])
{
	CCSet set;
	for (int i = 0; i < num; ++i)
	{
		int id = ids[i];
		float x = xs[i];
		float y = ys[i];

		CCInteger* pIndex = (CCInteger*) s_TouchesIntergerDict.objectForKey(id);
		int nUnusedIndex = 0;

		// it is a new touch
		if (pIndex == NULL)
		{
			nUnusedIndex = getUnUsedIndex();

			// The touches is more than MAX_TOUCHES ?
			if (nUnusedIndex == -1)
			{
				CCLOG("The touches is more than MAX_TOUCHES, nUnusedIndex = %d",
					nUnusedIndex);
				continue;
			}

			CCTouch* pTouch = s_pTouches[nUnusedIndex] = new CCTouch();
			if (m_bIsRetinaEnabled)
			{
				// on iOS, though retina is enabled, the value got from os is also 
				// relative to its original size
				pTouch->setTouchInfo(nUnusedIndex,
					(x - m_obViewPortRect.origin.x),
					(y - m_obViewPortRect.origin.y));
			}
			else
			{
				pTouch->setTouchInfo(nUnusedIndex,
					(x - m_obViewPortRect.origin.x) / m_fScaleX,
					(y - m_obViewPortRect.origin.y) / m_fScaleY);
			}

			//CCLOG("x = %f y = %f", pTouch->getLocationInView().x, pTouch->getLocationInView().y);

			CCInteger* pInterObj = new CCInteger(nUnusedIndex);
			s_TouchesIntergerDict.setObject(pInterObj, id);
			set.addObject(pTouch);
			pInterObj->release();
		}
	}

	if (set.count() == 0)
	{
		CCLOG("touchesBegan: count = 0");
		return;
	}

	m_pDelegate->touchesBegan(&set, NULL);
}
开发者ID:korman,项目名称:Temp,代码行数:59,代码来源:CCEGLViewProtocol.cpp

示例10: getSetOfTouchesEndOrCancel

void CCEGLViewProtocol::getSetOfTouchesEndOrCancel(CCSet& set, int num,
												   int ids[], float xs[], float ys[])
{
	for (int i = 0; i < num; ++i)
	{
		int id = ids[i];
		float x = xs[i];
		float y = ys[i];

		CCInteger* pIndex = (CCInteger*) s_TouchesIntergerDict.objectForKey(id);
		if (pIndex == NULL)
		{
			CCLOG("if the index doesn't exist, it is an error");
			continue;
		}
		/* Add to the set to send to the director */
		CCTouch* pTouch = s_pTouches[pIndex->getValue()];
		if (pTouch)
		{
			CCLOGINFO("Ending touches with id: %d, x=%f, y=%f", id, x, y);

			if (m_bIsRetinaEnabled)
			{
				pTouch->setTouchInfo(pIndex->getValue(),
					(x - m_obViewPortRect.origin.x),
					(y - m_obViewPortRect.origin.y));
			}
			else
			{
				pTouch->setTouchInfo(pIndex->getValue(),
					(x - m_obViewPortRect.origin.x) / m_fScaleX,
					(y - m_obViewPortRect.origin.y) / m_fScaleY);
			}

			set.addObject(pTouch);

			// release the object
			pTouch->release();
			s_pTouches[pIndex->getValue()] = NULL;
			removeUsedIndexBit(pIndex->getValue());

			s_TouchesIntergerDict.removeObjectForKey(id);

		}
		else
		{
			CCLOG("Ending touches with id: %d error", id);
			return;
		}

	}

	if (set.count() == 0)
	{
		CCLOG("touchesEnded or touchesCancel: count = 0");
		return;
	}
}
开发者ID:korman,项目名称:Temp,代码行数:58,代码来源:CCEGLViewProtocol.cpp

示例11: ccTouchEnded

void ScrollMenu::ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent)
{
    CCSet set;
    set.addObject(pTouch);
    scrollView->ccTouchesEnded(&set, pEvent);
    if(scrollView->getCurrentNodeId() == 0)
        menuLeft();
    else if(scrollView->getCurrentNodeId() == scrollView->endNodeIndex)
        menuRight();
}
开发者ID:13609594236,项目名称:ph-open,代码行数:10,代码来源:PageScrollView.cpp

示例12: handleTouchesMove

void CCEGLViewProtocol::handleTouchesMove(int num, int ids[], float xs[],
										  float ys[])
{
	CCSet set;
	for (int i = 0; i < num; ++i)
	{
		int id = ids[i];
		float x = xs[i];
		float y = ys[i];

		CCInteger* pIndex = (CCInteger*) s_TouchesIntergerDict.objectForKey(id);
		if (pIndex == NULL)
		{
			CCLOG("if the index doesn't exist, it is an error");
			continue;
		}

		CCLOGINFO("Moving touches with id: %d, x=%f, y=%f", id, x, y);
		CCTouch* pTouch = s_pTouches[pIndex->getValue()];
		if (pTouch)
		{
			if (m_bIsRetinaEnabled)
			{
				pTouch->setTouchInfo(pIndex->getValue(),
					(x - m_obViewPortRect.origin.x),
					(y - m_obViewPortRect.origin.y));
			}
			else
			{
				pTouch->setTouchInfo(pIndex->getValue(),
					(x - m_obViewPortRect.origin.x) / m_fScaleX,
					(y - m_obViewPortRect.origin.y) / m_fScaleY);
			}

			set.addObject(pTouch);
		}
		else
		{
			// It is error, should return.
			CCLOG("Moving touches with id: %d error", id);
			return;
		}
	}

	if (set.count() == 0)
	{
		CCLOG("touchesMoved: count = 0");
		return;
	}

	m_pDelegate->touchesMoved(&set, NULL);
}
开发者ID:korman,项目名称:Temp,代码行数:52,代码来源:CCEGLViewProtocol.cpp

示例13: CCSet

	void UIScrollLayer::cancelAndStoleTouch(CCTouch* pTouch, CCEvent* pEvent)
	{
		// Throw Cancel message for everybody in TouchDispatcher.
		CCSet* touchSet = new CCSet();
		touchSet->addObject(pTouch);
		touchSet->autorelease();
		CCDirector::sharedDirector()->getTouchDispatcher()->touchesCancelled(touchSet, pEvent);
    
		//< after doing this touch is already removed from all targeted handlers
    
		// Squirrel away the touch
		claimTouch(pTouch);
	}
开发者ID:niuzb,项目名称:hellopet,代码行数:13,代码来源:UIScrollLayer.cpp

示例14: CCSet

void CCStoreScene::testLoadProducts(CCObject* pSender)
{
    CCSet* productsId = new CCSet();
    productsId->autorelease();
    
    CCNative::createAlert("Waiting", "Retrieving Product Information", NULL);
    CCNative::showAlert();
    
    // SET YOUR IAP PRODUCT ID TO HERE
    productsId->addObject(newCCString("org.cocos2d-x.games.demo.iap01"));
    productsId->addObject(newCCString("org.cocos2d-x.games.demo.iap02"));
    productsId->addObject(newCCString("org.cocos2d-x.games.demo.iap03"));
    CCStore::sharedStore()->loadProducts(productsId, this);
}
开发者ID:AungPyae,项目名称:cocos2d-x-extensions,代码行数:14,代码来源:CCStoreScene.cpp

示例15: useForFileExtensions

bool CC3STBImage::shouldUseForFileExtension( const std::string& fileExtension )
{
	CCSet* pExtensions = useForFileExtensions();
	CCString *pExt;
	CCSetIterator setIter;
	for (setIter = pExtensions->begin(); setIter != pExtensions->end(); ++setIter)
	{
		pExt = (CCString *)(*setIter);
		if ( pExt->compare( fileExtension.c_str() ) == 0 ) 
			return true;
	}

	return false;
}
开发者ID:ClAndHHL,项目名称:cocos3d-x,代码行数:14,代码来源:CC3STBImage.cpp


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