本文整理汇总了C++中CCNode::convertToWorldSpace方法的典型用法代码示例。如果您正苦于以下问题:C++ CCNode::convertToWorldSpace方法的具体用法?C++ CCNode::convertToWorldSpace怎么用?C++ CCNode::convertToWorldSpace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCNode
的用法示例。
在下文中一共展示了CCNode::convertToWorldSpace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getParent
//=============================================================
//=============================================================
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);
}
示例2: perform
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;
}