本文整理汇总了C++中CC_RETURN_IF函数的典型用法代码示例。如果您正苦于以下问题:C++ CC_RETURN_IF函数的具体用法?C++ CC_RETURN_IF怎么用?C++ CC_RETURN_IF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CC_RETURN_IF函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CC_RETURN_IF
void CAPageView::ccTouchMoved(CATouch *pTouch, CAEvent *pEvent)
{
CC_RETURN_IF(m_pViews.empty());
CAScrollView::ccTouchMoved(pTouch, pEvent);
}
示例2: CC_RETURN_IF
void FourthViewController::playAnimation(CAControl* btn, CCPoint point)
{
CC_RETURN_IF(isDoAction);
this->doAction();
}
示例3: CC_RETURN_IF
void CALabel::setText(const string& var)
{
CC_RETURN_IF(m_nText.compare(var) == 0);
m_nText = var;
this->updateImageDraw();
}
示例4: CC_RETURN_IF
void CommonUrlImageView::setUrl(const std::string& url)
{
CC_RETURN_IF(url.empty());
m_sUrl = DecodeURL(url);
CommonHttpManager::getInstance()->get_image(m_sUrl, this, CommonHttpImage_selector(CommonUrlImageView::onRequestFinished), m_eType);
}
示例5: CC_RETURN_IF
void CAListViewCell::selectedListViewCell()
{
CC_RETURN_IF(m_pBackgroundView == NULL);
m_pBackgroundView->setColor(ccc4(50, 193, 255, 255));
}
示例6: CC_RETURN_IF
void CALabel::onEnterTransitionDidFinish()
{
CAView::onEnterTransitionDidFinish();
CC_RETURN_IF(m_nText.empty());
this->updateImage();
}
示例7: CC_RETURN_IF
void CATabBarController::setTabBarHidden(bool hidden, bool animated)
{
CC_RETURN_IF(m_bTabBarHidden == hidden);
m_bTabBarHidden = hidden;
CC_RETURN_IF(this->getView()->getSuperview() == NULL);
CCPoint point = CCPointZero;
if (m_bTabBarHidden)
{
switch (m_eTabBarVerticalAlignment)
{
case CABarVerticalAlignmentTop:
{
point.y = -m_pTabBar->getFrame().size.height;
}
break;
case CABarVerticalAlignmentBottom:
{
point.y = this->getView()->getBounds().size.height;
}
break;
default:
break;
}
}
else
{
switch (m_eTabBarVerticalAlignment)
{
case CABarVerticalAlignmentTop:
{
point.y = 0;
}
break;
case CABarVerticalAlignmentBottom:
{
point.y = this->getView()->getBounds().size.height - m_pTabBar->getFrame().size.height;
}
break;
default:
break;
}
}
if (animated)
{
m_pTabBar->stopAllActions();
CCFrameOrginTo* moveTo = CCFrameOrginTo::create(0.3f, point);
CCEaseSineOut* easeBack = CCEaseSineOut::create(moveTo);
CCCallFunc* begin = CCCallFunc::create(this, callfunc_selector(CATabBarController::scheduleUpdate));
CCCallFunc* end = CCCallFunc::create(this, callfunc_selector(CATabBarController::unScheduleUpdate));
CCDelayTime* delayTime = CCDelayTime::create(0.1f);
CCSequence* actions = CCSequence::create(begin, easeBack, delayTime, end, NULL);
m_pTabBar->runAction(actions);
}
else
{
m_pTabBar->setFrameOrigin(point);
if (this->getView()->getSuperview())
{
this->update(0);
}
}
}
示例8: CC_RETURN_IF
void CAScrollView::ccTouchMoved(CATouch *pTouch, CAEvent *pEvent)
{
CC_RETURN_IF(m_bPCMode);
CC_RETURN_IF(m_vTouches.contains(pTouch) == false);
DPoint p_container = m_pContainer->getFrameOrigin();
DPoint p_off = DPointZero;
if (m_vTouches.size() == 1)
{
p_off = ccpSub(this->convertToNodeSpace(pTouch->getLocation()),
this->convertToNodeSpace(pTouch->getPreviousLocation()));
DPoint off = p_off;
if (off.getLength() <= 5)
{
off = DPointZero;
}
m_tPointOffset.push_back(off);
}
else if (m_vTouches.size() == 2)
{
CATouch* touch0 = dynamic_cast<CATouch*>(m_vTouches.at(0));
CATouch* touch1 = dynamic_cast<CATouch*>(m_vTouches.at(1));
DPoint mid_point = ccpMidpoint(this->convertToNodeSpace(touch0->getLocation()),
this->convertToNodeSpace(touch1->getLocation()));
p_off = ccpSub(mid_point, ccpAdd(p_container, m_pContainer->getAnchorPointInPoints() * m_fZoomScale));
if (m_fMinimumZoomScale < m_fMaximumZoomScale)
{
float touch_lenght = ccpDistance(this->convertToNodeSpace(touch0->getLocation()) ,
this->convertToNodeSpace(touch1->getLocation()));
float scale_off = (touch_lenght - m_fTouchLength) * 0.0020f;
m_fZoomScale = m_pContainer->getScale();
m_fZoomScale += m_fZoomScale * scale_off;
m_fZoomScale = MIN(m_fZoomScale, m_fMaximumZoomScale);
m_fZoomScale = MAX(m_fZoomScale, m_fMinimumZoomScale);
m_pContainer->setScale(m_fZoomScale);
m_fTouchLength = touch_lenght;
}
}
if (m_bBounces)
{
DSize size = this->getBounds().size;
DPoint curr_point = m_pContainer->getFrameOrigin();
DPoint relust_point = curr_point;
this->getScrollWindowNotOutPoint(relust_point);
float lenght_x = fabsf(curr_point.x - relust_point.x);
float lenght_y = fabsf(curr_point.y - relust_point.y);
DPoint scale = DPoint(1.0f, 1.0f);
if (!(lenght_x < FLT_EPSILON))
{
scale.x = (0.5f - MIN(lenght_x / size.width, 0.5f));
p_off.x *= scale.x;
}
if (!(lenght_y < FLT_EPSILON))
{
scale.y = (0.5f - MIN(lenght_y / size.height, 0.5f));
p_off.y *= scale.y;
}
}
p_container = ccpAdd(p_container, p_off);
if (m_bBounces == false)
{
this->getScrollWindowNotOutPoint(p_container);
}
else
{
if (m_bBounceHorizontal == false)
{
p_container.x = this->getScrollWindowNotOutHorizontal(p_container.x);
}
if (m_bBounceVertical == false)
{
p_container.y = this->getScrollWindowNotOutVertical(p_container.y);
}
}
if (p_container.equals(m_pContainer->getFrameOrigin()) == false)
{
if (m_bTouchEnabledAtSubviews)
{
m_pContainer->setTouchEnabled(false);
}
this->setContainerFrame(p_container);
this->showIndicator();
if (m_bTracking == false)
{
//.........这里部分代码省略.........
示例9: CC_RETURN_IF
void CATouchController::touchMoved()
{
CC_RETURN_IF(ccpDistance(m_tFirstPoint, m_pTouch->getLocation()) < _px(32));
m_tFirstPoint = CCPointZero;
if (!m_vTouchMovedsViewCache.empty())
{
bool isScheduledPassing = CAScheduler::isScheduled(schedule_selector(CATouchController::passingTouchesViews), this);
CAScheduler::unschedule(schedule_selector(CATouchController::passingTouchesViews), this);
while (!m_vTouchMovedsViewCache.empty())
{
CAResponder* responder = m_vTouchMovedsViewCache.back();
CCPoint pointOffSet = CCPointZero;
if (CAView* v = dynamic_cast<CAView*>(responder))
{
pointOffSet = ccpSub(v->convertToNodeSpace(m_pTouch->getLocation()),
v->convertToNodeSpace(m_pTouch->getPreviousLocation()));
}
else if (CAViewController* c = dynamic_cast<CAViewController*>(responder))
{
pointOffSet = ccpSub(c->getView()->convertToNodeSpace(m_pTouch->getLocation()),
c->getView()->convertToNodeSpace(m_pTouch->getPreviousLocation()));
}
else
{
pointOffSet = ccpSub(m_pTouch->getLocation(), m_pTouch->getPreviousLocation());
}
pointOffSet.x = fabsf(pointOffSet.x);
pointOffSet.y = fabsf(pointOffSet.y);
do
{
CC_BREAK_IF(!responder->isTouchMovedListenHorizontal() && pointOffSet.x >= pointOffSet.y);
CC_BREAK_IF(!responder->isTouchMovedListenVertical() && pointOffSet.x < pointOffSet.y);
m_vTouchMovedsView.pushBack(m_vTouchMovedsViewCache.back());
}
while (0);
m_vTouchMovedsViewCache.popBack();
}
CAVector<CAResponder * > tTouchesViews = m_vTouchesViews;
if (!m_vTouchMovedsView.empty())
{
if (!isScheduledPassing)
{
CAVector<CAResponder*>::iterator itr;
//
for (itr = m_vTouchMovedsView.begin(); itr != m_vTouchMovedsView.end(); itr++)
{
m_vTouchesViews.eraseObject(*itr, true);
}
//
for (itr=m_vTouchesViews.begin(); itr!=m_vTouchesViews.end(); itr++)
{
(*itr)->ccTouchCancelled(m_pTouch, m_pEvent);
}
}
{
m_vTouchesViews.clear();
for (int i=0; i<m_vTouchMovedsView.size(); i++)
{
CAResponder* responder = m_vTouchMovedsView.at(i);
CCPoint pointOffSet = CCPointZero;
if (CAView* v = dynamic_cast<CAView*>(responder))
{
pointOffSet = ccpSub(v->convertToNodeSpace(m_pTouch->getLocation()),
v->convertToNodeSpace(m_pTouch->getPreviousLocation()));
}
else if (CAViewController* c = dynamic_cast<CAViewController*>(responder))
{
pointOffSet = ccpSub(c->getView()->convertToNodeSpace(m_pTouch->getLocation()),
c->getView()->convertToNodeSpace(m_pTouch->getPreviousLocation()));
}
else
{
pointOffSet = ccpSub(m_pTouch->getLocation(), m_pTouch->getPreviousLocation());
}
if (responder->isTouchMovedListenHorizontal()
&& fabsf(pointOffSet.x) >= fabsf(pointOffSet.y))
{
CC_CONTINUE_IF(responder->isSlidingMinX() && pointOffSet.x > 0);
CC_CONTINUE_IF(responder->isSlidingMaxX() && pointOffSet.x < 0);
}
if (responder->isTouchMovedListenVertical()
&& fabsf(pointOffSet.x) < fabsf(pointOffSet.y))
{
CC_CONTINUE_IF(responder->isSlidingMinY() && pointOffSet.y > 0);
CC_CONTINUE_IF(responder->isSlidingMaxY() && pointOffSet.y < 0);
//.........这里部分代码省略.........
示例10: CC_RETURN_IF
void CATouchController::touchMoved()
{
CC_RETURN_IF(ccpDistance(m_tFirstPoint, m_pTouch->getLocation()) < 16);
m_tFirstPoint = DPointZero;
if (!m_vTouchMovedsViewCache.empty())
{
bool isScheduledPassing = CAScheduler::isScheduled(schedule_selector(CATouchController::passingTouchesViews), this);
bool isTouchEventScrollHandOverToSuperview = true;
for (CAVector<CAResponder*>::iterator itr=m_vTouchesViews.begin();
itr!=m_vTouchesViews.end(); itr++)
{
CC_CONTINUE_IF((*itr)->isTouchEventScrollHandOverToSuperview());
isTouchEventScrollHandOverToSuperview = false;
break;
}
if (isScheduledPassing || isTouchEventScrollHandOverToSuperview)
{
CAScheduler::unschedule(schedule_selector(CATouchController::passingTouchesViews), this);
while (!m_vTouchMovedsViewCache.empty())
{
CAResponder* responder = m_vTouchMovedsViewCache.back();
DPoint pointOffSet = DPointZero;
if (CAView* v = dynamic_cast<CAView*>(responder))
{
pointOffSet = ccpSub(v->convertToNodeSpace(m_pTouch->getLocation()),
v->convertToNodeSpace(m_pTouch->getPreviousLocation()));
}
else if (CAViewController* c = dynamic_cast<CAViewController*>(responder))
{
pointOffSet = ccpSub(c->getView()->convertToNodeSpace(m_pTouch->getLocation()),
c->getView()->convertToNodeSpace(m_pTouch->getPreviousLocation()));
}
else
{
pointOffSet = ccpSub(m_pTouch->getLocation(), m_pTouch->getPreviousLocation());
}
pointOffSet.x = fabsf(pointOffSet.x);
pointOffSet.y = fabsf(pointOffSet.y);
do
{
CC_BREAK_IF(!responder->isHorizontalScrollEnabled() && pointOffSet.x >= pointOffSet.y);
CC_BREAK_IF(!responder->isVerticalScrollEnabled() && pointOffSet.x < pointOffSet.y);
m_vTouchMovedsView.pushBack(m_vTouchMovedsViewCache.back());
}
while (0);
m_vTouchMovedsViewCache.popBack();
}
if (!m_vTouchMovedsView.empty())
{
bool isTouchCancelled = true;
CAVector<CAResponder*>::iterator itr;
for (itr=m_vTouchesViews.begin(); itr!=m_vTouchesViews.end(); itr++)
{
CAResponder* responder = (*itr);
if (responder->isPriorityScroll())
{
DPoint pointOffSet = DPointZero;
if (CAView* v = dynamic_cast<CAView*>(responder))
{
pointOffSet = ccpSub(v->convertToNodeSpace(m_pTouch->getLocation()),
v->convertToNodeSpace(m_pTouch->getPreviousLocation()));
}
else if (CAViewController* c = dynamic_cast<CAViewController*>(responder))
{
pointOffSet = ccpSub(c->getView()->convertToNodeSpace(m_pTouch->getLocation()),
c->getView()->convertToNodeSpace(m_pTouch->getPreviousLocation()));
}
else
{
pointOffSet = ccpSub(m_pTouch->getLocation(), m_pTouch->getPreviousLocation());
}
if (!responder->isReachBoundaryHandOverToSuperview())
{
isTouchCancelled = false;
break;
}
if (responder->isHorizontalScrollEnabled()
&& fabsf(pointOffSet.x) >= fabsf(pointOffSet.y))
{
if (!responder->isReachBoundaryLeft() && pointOffSet.x >= 0)
{
isTouchCancelled = false;
break;
}
if (!responder->isReachBoundaryRight() && pointOffSet.x <= 0)
{
isTouchCancelled = false;
//.........这里部分代码省略.........
示例11: CC_RETURN_IF
void CATableView::firstReloadData()
{
CC_RETURN_IF(!m_pUsedTableCells.empty());
this->reloadData();
}
示例12: CC_RETURN_IF
void CATableView::ccTouchEnded(CATouch *pTouch, CAEvent *pEvent)
{
CC_RETURN_IF(m_pTouches->containsObject(pTouch) == false);
CAScrollView::ccTouchEnded(pTouch, pEvent);
if (m_pHighlightedTableCells)
{
m_pContainer->stopAllActions();
CAIndexPath2E deselectedIndexPath = CAIndexPath2EZero;
CAIndexPath2E selectedIndexPath = CAIndexPath2E(m_pHighlightedTableCells->getSection(), m_pHighlightedTableCells->getRow());
m_pHighlightedTableCells = NULL;
if (m_pSelectedTableCells.count(selectedIndexPath) > 0 && m_bAllowsMultipleSelection)
{
deselectedIndexPath = selectedIndexPath;
selectedIndexPath = CAIndexPath2EZero;
m_pSelectedTableCells.erase(deselectedIndexPath);
}
else
{
if (!m_pSelectedTableCells.empty() && m_bAllowsMultipleSelection == false)
{
deselectedIndexPath = *m_pSelectedTableCells.begin();
m_pSelectedTableCells.clear();
}
m_pSelectedTableCells.insert(selectedIndexPath);
}
if (deselectedIndexPath != CAIndexPath2EZero)
{
if (CATableViewCell* cell = m_pUsedTableCells[deselectedIndexPath])
{
cell->setControlStateNormal();
}
if (m_pTableViewDelegate)
{
m_pTableViewDelegate->tableViewDidDeselectRowAtIndexPath(this,
deselectedIndexPath.section,
deselectedIndexPath.row);
}
}
if (selectedIndexPath != CAIndexPath2EZero)
{
if (CATableViewCell* cell = m_pUsedTableCells[selectedIndexPath])
{
cell->setControlStateSelected();
}
if (m_pTableViewDelegate)
{
m_pTableViewDelegate->tableViewDidSelectRowAtIndexPath(this,
selectedIndexPath.section,
selectedIndexPath.row);
}
}
}
}
示例13: CC_RETURN_IF
void CATableViewCell::highlightedTableViewCell()
{
CC_RETURN_IF(m_pBackgroundView == NULL);
m_pBackgroundView->setColor(ccc4(50, 193, 255, 255));
}
示例14: CC_RETURN_IF
void CANavigationBar::setTitleColor(CAColor4B color)
{
m_cTitleColor = color;
CC_RETURN_IF(!m_bRunning);
this->showTitle();
}
示例15: CC_RETURN_IF
void CAListView::firstReloadData()
{
CC_RETURN_IF(!m_pUsedListCells.empty());
this->reloadData();
}