void GameLayer::ccTouchesBegan(CCSet* pTouch, CCEvent* pEvent){
	
	//check if the backIcon is pressed
	CCTouch *touch = (CCTouch*)pTouch->anyObject();
	CCPoint location = touch->getLocation();
	CCDirector* pDirector = CCDirector::sharedDirector();
	CCSize winSize = pDirector->getWinSize();
	float icon_radius = backIcon->getContentSize().height / 2;
	//distance from icon target to center of the sprite
	float distanceSQ = ccpDistanceSQ(location, backIcon->getPosition());
	if (distanceSQ <= icon_radius * icon_radius){
		//change the icon to pressed
		//MapLayer::getMap()->unlockNextLevel();
		pDirector->popScene();
		return;
	}
	//back button checking ended
	
	
	//gesture detection initiate
	ccp_last = touch->getLocationInView();
	ccp_last = pDirector->convertToGL(ccp_last);

	b_click = true;
	b_rect = false;
	b_circle = false;
	count_order = 0;
	gd_direction = kGDirectionNo;

	for (int i = 0; i < 4; i++){
		cache_deirectionshape[i] = false;
	}
	//gesture detection ended
}
Example #2
0
void SceneManager::pop()
{
	CCDirector* director = CCDirector::sharedDirector();  
	if (director->getRunningScene())
	{  
		director->popScene();
	}
}