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


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

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


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

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

示例2: HandleTouchesEnd

void App::HandleTouchesEnd(int num, int ids[], float xs[], float ys[])
{
	int			i;
	int			id;
    float		x;
    float		y;
	CCSet		set;
	CCTouch*	pTouch;
	CCInteger*	pIndex;
	
	for (i = 0; i < num; ++i)
    {
        id	= ids[i];
        x	= xs[i];
        y	= ys[i];

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

            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;
        } 

    }

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

示例3: onTouchesEnd

void CCEGLView::onTouchesEnd(int id[], float x[], float y[], int pointerNumber)
{
	result r = E_SUCCESS;
	CCSet set;
	for(int i = 0 ; i < pointerNumber ; 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);
			s_mapTouches.Remove(id[i]);
			pTouch->release();
			CCLOG("Ending touches with id: %d, x=%f, y=%f, retain count = %d", id[i], x[i], y[i], pTouch->retainCount());
		}
	}

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

示例4: OnPointerOff

void CCTouchDispatcher::OnPointerOff(const InputPointerEvent* evt)
{
	map<Ref<InputPointer>, CCTouch*>::type::iterator itr = m_Touches.find(evt->getSource());
	if (itr == m_Touches.end())
		return;

	CCSet set;
	CCTouch* pTouch = itr->second;
	m_Touches.erase(itr);

	pTouch->SetTouchInfo(0, evt->getPos().x, evt->getPos().y);

	set.addObject(pTouch);

//  	LOG(0, ".. off %.3f %.3f\n", evt->GetPos().x, evt->GetPos().y);

	touchesEnded(&set);

	pTouch->release();
}
开发者ID:noriter,项目名称:nit,代码行数:20,代码来源:CCTouchDispatcher.cpp

示例5:

	void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesEnd(JNIEnv*  env, jobject thiz, jint id, jfloat x, jfloat y)
	{
		CCRect rcRect = CCEGLView::sharedOpenGLView().getViewPort();
		CCSet set;

		/* Add to the set to send to the director */
		CCTouch* pTouch = s_pTouches[id];		
		if (pTouch)
		{
			LOGD("Ending touches with id: %d, x=%f, y=%f", id, x, y);

			pTouch->SetTouchInfo(0, x - rcRect.origin.x , y - rcRect.origin.y, id);
		    set.addObject(pTouch);

			// release the object
			pTouch->release();
			s_pTouches[id] = NULL;

			cocos2d::CCDirector::sharedDirector()->getOpenGLView()->getDelegate()->touchesEnded(&set, NULL);
		} else {
			LOGD("Ending touches with id: %d error", id);
		}		
	}
开发者ID:authorly,项目名称:interapptive,代码行数:23,代码来源:TouchesJni.cpp

示例6: HandleEvents


//.........这里部分代码省略.........
		}
		else
		{
#else
		else if (domain == screen_get_domain())
		{
			m_screenEvent = screen_event_get_event(event);
#endif
			rc = screen_get_event_property_iv(m_screenEvent, SCREEN_PROPERTY_TYPE, &val);
			if (rc || val == SCREEN_EVENT_NONE)
				break;

			switch (val)
			{
				case SCREEN_EVENT_CLOSE:
					fprintf(stderr, "SCREEN CLOSE EVENT!\n");
					break;

				case SCREEN_EVENT_MTOUCH_RELEASE:
					screen_get_mtouch_event(m_screenEvent, &mtouch_event, 0);
					touch_id = mtouch_event.contact_id;

					if (m_pDelegate && touch_id < MAX_TOUCHES)
					{
						CCTouch* touch = s_pTouches[touch_id];
						if (touch)
						{
							CCSet set;
							touch->SetTouchInfo(((float)(mtouch_event.x) - m_rcViewPort.origin.x) / m_fScreenScaleFactor,
												   ((float)(mtouch_event.y) - m_rcViewPort.origin.y) / m_fScreenScaleFactor);
							set.addObject(touch);
							m_pDelegate->touchesEnded(&set, NULL);

							touch->release();
							for (int i = touch_id; i < MAX_TOUCHES; i++)
							{
								if (i != (MAX_TOUCHES - 1))
								{
									s_pTouches[i] = s_pTouches[i + 1];
								}
								else
								{
									s_pTouches[i] = NULL;
								}
							}
						}
					}

					break;

				case SCREEN_EVENT_MTOUCH_TOUCH:
					screen_get_mtouch_event(m_screenEvent, &mtouch_event, 0);
					touch_id = mtouch_event.contact_id;

					if (m_pDelegate && touch_id < MAX_TOUCHES)
					{
						CCTouch* touch = s_pTouches[touch_id];
						if (!touch)
							touch = new CCTouch;

						touch->SetTouchInfo(((float)(mtouch_event.x) - m_rcViewPort.origin.x) / m_fScreenScaleFactor,
											   ((float)(mtouch_event.y) - m_rcViewPort.origin.y) / m_fScreenScaleFactor);
						s_pTouches[touch_id] = touch;

						CCSet set;
						set.addObject(touch);
开发者ID:AfterTheRainOfStars,项目名称:cocos2d-x-qt,代码行数:67,代码来源:CCEGLView_qnx.cpp

示例7: HandleEvents

bool CCEGLView::HandleEvents()
{
	bps_event_t*    event = NULL;
	mtouch_event_t  mtouch_event;
	int				touch_id = 0;
	int				val = 0;
	int				rc = 0;
	int 			domain = 0;
	char 			buf[4] = {0};

#ifdef BPS_EVENTS
	for (;;)
	{
		rc = bps_get_event(&event, 1);
		assert(rc == BPS_SUCCESS);

		// break if no more events
		if (event == NULL)
			break;

		domain = bps_event_get_domain(event);

		if (domain == screen_get_domain())
		{
			m_screenEvent = screen_event_get_event(event);

#else
		while (!screen_get_event(m_screenContext, m_screenEvent, 0))
		{
#endif
			rc = screen_get_event_property_iv(m_screenEvent, SCREEN_PROPERTY_TYPE, &val);
			if (rc || val == SCREEN_EVENT_NONE)
				break;

			switch (val)
			{
				case SCREEN_EVENT_CLOSE:
					fprintf(stderr, "SCREEN CLOSE EVENT!\n");
					break;

				case SCREEN_EVENT_MTOUCH_RELEASE:
					screen_get_mtouch_event(m_screenEvent, &mtouch_event, 0);
					touch_id = mtouch_event.contact_id;

					if (m_pDelegate && touch_id < MAX_TOUCHES)
					{
						CCTouch* touch = s_pTouches[touch_id];
						if (touch)
						{
							CCSet set;
							touch->SetTouchInfo(0, ((float)(mtouch_event.x) - m_rcViewPort.origin.x) / m_fScreenScaleFactor,
									((float)(mtouch_event.y) - m_rcViewPort.origin.y) / m_fScreenScaleFactor);
							set.addObject(touch);
							m_pDelegate->touchesEnded(&set, NULL);

							touch->release();
							for (int i = touch_id; i < MAX_TOUCHES; i++)
							{
								if (i != (MAX_TOUCHES - 1))
								{
									s_pTouches[i] = s_pTouches[i + 1];
								}
								else
								{
									s_pTouches[i] = NULL;
								}
							}
						}
					}

					break;

				case SCREEN_EVENT_MTOUCH_TOUCH:
					screen_get_mtouch_event(m_screenEvent, &mtouch_event, 0);
					touch_id = mtouch_event.contact_id;

					if (m_pDelegate && touch_id < MAX_TOUCHES)
					{
						CCTouch* touch = s_pTouches[touch_id];
						if (!touch)
							touch = new CCTouch;

						touch->SetTouchInfo(0, ((float)(mtouch_event.x) - m_rcViewPort.origin.x) / m_fScreenScaleFactor,
								((float)(mtouch_event.y) - m_rcViewPort.origin.y) / m_fScreenScaleFactor);
						s_pTouches[touch_id] = touch;

						CCSet set;
						set.addObject(touch);
						m_pDelegate->touchesBegan(&set, NULL);
					}

					break;

				case SCREEN_EVENT_MTOUCH_MOVE:
					screen_get_mtouch_event(m_screenEvent, &mtouch_event, 0);
					touch_id = mtouch_event.contact_id;

					if (m_pDelegate && touch_id < MAX_TOUCHES)
					{
						CCTouch* touch = s_pTouches[touch_id];
//.........这里部分代码省略.........
开发者ID:Glikeme,项目名称:cocos2dx-webos,代码行数:101,代码来源:CCEGLView_qnx.cpp


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