//============================================================= //============================================================= void CC3DCircleListLayer::ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent) { if(!isVisible()) { return ; } CCNode* fatherNode = getParent(); if(!fatherNode) return ; CCPoint touchPointInWorld = pTouch->getLocation(); CCPoint prePointInWorld = pTouch->getPreviousLocation(); m_fLastMoveDis = touchPointInWorld.x - prePointInWorld.x; CCRect selfRect = boundingBox(); CCPoint selfOriginInWorld = fatherNode->convertToWorldSpace(selfRect.origin); CCRect selfRectInWorld = CCRectMake(selfOriginInWorld.x,selfOriginInWorld.y,selfRect.size.width,selfRect.size.height); if(selfRectInWorld.containsPoint(touchPointInWorld) == false) { touchEnd(); return; } refreshItem(m_fLastMoveDis); }
bool SFVideo::perform(CCDictionary * pDict, cocos2d::CCNode * pTarget) { if (!pDict) { CNLog("error"); return false; } CCString * pTask = (CCString *)pDict->objectForKey("Task"); if (!pTask) { CNLog("invalid video task"); return false; } const char * task = pTask->getCString(); CNLog("SFVideo: ******************************** %s", task); if (strlen(task) == 0) { CNLog("invalid task"); } else if (strcasecmp(task, "Init") == 0 || strcasecmp(task, "InitPlayer") == 0) { CNLog("init video player"); if (pTarget) { CCNode * pParent = pTarget->getParent(); if (pParent) { CCPoint position = ccpSub(pTarget->getPosition(), pTarget->getAnchorPointInPoints()); CCPoint p2 = ccpAdd(position, ccpFromSize(pTarget->getContentSize())); position = pParent->convertToWorldSpace(position); p2 = pParent->convertToWorldSpace(p2); SFVideo_initPlayer(position.x, position.y, p2.x - position.x, p2.y - position.y); } else { CNLog("error"); } } else { CNLog("error"); } } else if (strcasecmp(task, "play") == 0 || strcasecmp(task, "playMovie") == 0) { CCString * pFilename = (CCString *)pDict->objectForKey("File"); const char * filename = pFilename ? pFilename->getCString() : ""; CNLog("playing video: %s", filename); SFVideo_playMovie(filename); } else if (strcasecmp(task, "stop") == 0 || strcasecmp(task, "stopMovie") == 0) { CNLog("stop video"); SFVideo_stopMovie(); } return true; }