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


C++ CCInteger::release方法代码示例

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


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

示例1: 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

示例2: 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();
			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;
    }

    CCEvent event;
    CCSet *allTouches= new CCSet;
    allTouches->autorelease();
    getCurrentSetOfTouches(*allTouches);
    event.setAllTouches(allTouches);
    m_pDelegate->touchesBegan(&set, &event);
}
开发者ID:vedi,项目名称:cocos2d-x,代码行数:49,代码来源:CCEGLViewProtocol.cpp

示例3: HandleTouchesBegin

void App::HandleTouchesBegin(int num, int ids[], float xs[], float ys[])
{
	int			i;
	int			id;
	int			nUnusedIndex;
    float		x;
    float		y;
	CCSet		set;
	CCTouch*	pTouch;
	CCInteger*	pIndex;
	CCInteger*	pInterObj;

    for (i = 0; i < num; ++i)
    {
        id	= ids[i];
        x	= xs[i];
        y	= ys[i];

        pIndex = (CCInteger*)s_TouchesIntergerDict.objectForKey(id);
        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;
            }

            pTouch = s_pTouches[nUnusedIndex] = new CCTouch();
			pTouch->setTouchInfo( nUnusedIndex, x, y );
                        
            pInterObj = new CCInteger(nUnusedIndex);
            s_TouchesIntergerDict.setObject(pInterObj, id);
            set.addObject(pTouch);
            pInterObj->release();
        }
    }

    if (set.count() > 0)
    {
        CCDirector::sharedDirector()->getTouchDispatcher()->touchesBegan(&set, NULL);
    }
}
开发者ID:andrew889,项目名称:proton_cm_open,代码行数:48,代码来源:App.cpp

示例4: dump_attribs_to_nodes

CCDictionary* Scriptor::dump_attribs_to_nodes(TiXmlElement* pElement, unsigned int indent, ScriptType st)
{
	if ( !pElement ) return NULL;
	if ( st == sUnknown) return NULL;		//关闭调试输出

	CCDictionary* dt = new CCDictionary(); 

	TiXmlAttribute* pAttrib=pElement->FirstAttribute();
	int i=0;
	int ival;
	double dval;

	while (pAttrib)
	{
		//CCLOG( "%s%s: value=[%s]", pIndent, pAttrib->Name(), pAttrib->Value());
		if (pAttrib->QueryIntValue(&ival)==TIXML_SUCCESS)   
		{
			CCInteger* ci = new CCInteger(ival);
			dt->setObject(ci,pAttrib->Name());
			ci->release();
		}
		else if (pAttrib->QueryDoubleValue(&dval)==TIXML_SUCCESS) 
		{
			NFloat* fl = new NFloat(dval);
			dt->setObject(fl,pAttrib->Name());
			fl->release();
		}
		else 
		{
			CCString* sl = new CCString(pAttrib->Value());
			dt->setObject(sl,pAttrib->Name());
			pAttrib->Value();
			CCLOG("value pair:%s||%s||%s",pAttrib->Value(),pAttrib->Name(),sl->getCString());
			sl->release();
		}
		i++;
		pAttrib=pAttrib->Next();
	}
	if(i>0)	return dt;
	else CC_SAFE_RELEASE_NULL(dt);
		
	return NULL;
}
开发者ID:frankiefanstar,项目名称:cocotd,代码行数:43,代码来源:Scriptor.cpp


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