本文整理汇总了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);
}
示例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);
}
示例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);
}
}
示例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;
}