这篇教程C++ CC_RETURN_IF函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CC_RETURN_IF函数的典型用法代码示例。如果您正苦于以下问题:C++ CC_RETURN_IF函数的具体用法?C++ CC_RETURN_IF怎么用?C++ CC_RETURN_IF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CC_RETURN_IF函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: CC_RETURN_IFvoid CAPageView::ccTouchMoved(CATouch *pTouch, CAEvent *pEvent){ CC_RETURN_IF(m_pViews.empty()); CAScrollView::ccTouchMoved(pTouch, pEvent);}
开发者ID:lmxing1987,项目名称:CrossApp,代码行数:5,
示例2: CC_RETURN_IFvoid FourthViewController::playAnimation(CAControl* btn, CCPoint point){ CC_RETURN_IF(isDoAction); this->doAction();}
开发者ID:MingjunHu,项目名称:CrossApp,代码行数:5,
示例3: CC_RETURN_IFvoid CALabel::setText(const string& var){ CC_RETURN_IF(m_nText.compare(var) == 0); m_nText = var; this->updateImageDraw();}
开发者ID:lmxing1987,项目名称:CrossApp,代码行数:6,
示例4: CC_RETURN_IFvoid 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);}
开发者ID:WoYang,项目名称:CrossApp,代码行数:6,
示例5: CC_RETURN_IFvoid CAListViewCell::selectedListViewCell(){ CC_RETURN_IF(m_pBackgroundView == NULL); m_pBackgroundView->setColor(ccc4(50, 193, 255, 255));}
开发者ID:dksai414,项目名称:CrossApp,代码行数:5,
示例6: CC_RETURN_IFvoid CALabel::onEnterTransitionDidFinish(){ CAView::onEnterTransitionDidFinish(); CC_RETURN_IF(m_nText.empty()); this->updateImage();}
开发者ID:13609594236,项目名称:CrossApp,代码行数:6,
示例7: CC_RETURN_IFvoid 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); } }}
开发者ID:Rogerlin2013,项目名称:CrossApp,代码行数:66,
示例8: CC_RETURN_IFvoid 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) {//.........这里部分代码省略.........
开发者ID:wjm0729,项目名称:CrossApp,代码行数:101,
示例9: CC_RETURN_IFvoid 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);//.........这里部分代码省略.........
开发者ID:zhaojietong,项目名称:CrossApp,代码行数:101,
示例10: CC_RETURN_IFvoid 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;//.........这里部分代码省略.........
开发者ID:wjm0729,项目名称:CrossApp,代码行数:101,
示例11: CC_RETURN_IFvoid CATableView::firstReloadData(){ CC_RETURN_IF(!m_pUsedTableCells.empty()); this->reloadData();}
开发者ID:Watchet,项目名称:CrossApp,代码行数:5,
示例12: CC_RETURN_IFvoid 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); } } } }
开发者ID:zhaojietong,项目名称:CrossApp,代码行数:62,
示例13: CC_RETURN_IFvoid CATableViewCell::highlightedTableViewCell(){ CC_RETURN_IF(m_pBackgroundView == NULL); m_pBackgroundView->setColor(ccc4(50, 193, 255, 255));}
开发者ID:yulei-cui,项目名称:CrossApp,代码行数:5,
示例14: CC_RETURN_IFvoid CANavigationBar::setTitleColor(CAColor4B color){ m_cTitleColor = color; CC_RETURN_IF(!m_bRunning); this->showTitle();}
开发者ID:AojiaoZero,项目名称:CrossApp,代码行数:6,
示例15: CC_RETURN_IFvoid CAListView::firstReloadData(){ CC_RETURN_IF(!m_pUsedListCells.empty()); this->reloadData();}
开发者ID:Laevatain,项目名称:CrossApp,代码行数:5,
示例16: updateImage void updateImage() { const std::string& sPlaceHolder = m_pTextFieldX->getPlaceHolderText(); CAColor4B cFontColor; std::string text; if (m_sText.empty()) { text = sPlaceHolder; cFontColor = m_pTextFieldX->getPlaceHolderColor(); } else { text = m_sText; cFontColor = m_pTextFieldX->getTextColor(); } if (m_pTextFieldX->isSecureTextEntry()) { std::string password; for (std::string::size_type i = 0; i < m_sText.length(); i++) { password.append("*"); } if (password.empty()) { text = sPlaceHolder; } else { text = password; } } int fontSize = m_pTextFieldX->getFontSize(); m_iFontHeight = CAImage::getFontHeight(m_szFontName.c_str(), fontSize); DSize size = DSize(0, m_iFontHeight); CAImage* image = CAImage::createWithString(text.c_str(), cFontColor, m_szFontName.c_str(), fontSize, size, CATextAlignmentLeft, CAVerticalTextAlignmentCenter, true); DRect rect = DRectZero; if (sPlaceHolder.length() == 0) { this->setImage(image); this->setImageRect(rect); } CC_RETURN_IF(image == NULL); rect.size.height = image->getContentSize().height; rect.size.width = MIN(m_iLabelWidth, image->getContentSize().width); if (text.empty()) { m_cImageSize = DSizeZero; } else { m_cImageSize = image->getContentSize(); } this->setImage(image); rect.origin.x = -m_iString_o_length; this->setImageRect(rect); }
开发者ID:boaass,项目名称:CrossApp,代码行数:70,
示例17: CC_RETURN_IFvoid CAAutoCollectionView::firstReloadData(){ CC_RETURN_IF(!m_mpUsedCollectionCells.empty()); this->reloadData();}
开发者ID:jango2015,项目名称:CrossApp,代码行数:5,
示例18: CC_RETURN_IFvoid CANavigationController::setNavigationBarHidden(bool hidden, bool animated){ CC_RETURN_IF(m_bNavigationBarHidden == hidden); m_bNavigationBarHidden = hidden; CC_RETURN_IF(this->getView()->getSuperview() == NULL); CCPoint point = CCPointZero; if (m_bNavigationBarHidden) { switch (m_eNavigationBarVerticalAlignment) { case CABarVerticalAlignmentTop: { point.y = -m_pNavigationBar->getFrame().size.height; } break; case CABarVerticalAlignmentBottom: { point.y = this->getView()->getBounds().size.height; } break; default: break; } } else { switch (m_eNavigationBarVerticalAlignment) { case CABarVerticalAlignmentTop: { point.y = 0; } break; case CABarVerticalAlignmentBottom: { point.y = this->getView()->getBounds().size.height - m_pNavigationBar->getFrame().size.height; } break; default: break; } } if (animated) { CCArray* array = CCArray::create(); array->addObject(CCEaseSineOut::create(CCFrameOrginTo::create(0.2f, point))); array->addObject(CCCallFunc::create(this, callfunc_selector(CANavigationController::scheduleUpdate))); array->addObject(CCCallFunc::create(this, callfunc_selector(CANavigationController::unScheduleUpdate))); array->addObject(CCDelayTime::create(0.1f)); m_pNavigationBar->runAction(CCSequence::create(array)); } else { m_pNavigationBar->setFrameOrigin(point); if (this->getView()->getSuperview()) { this->update(0); } } }
开发者ID:dlpc,项目名称:CrossApp,代码行数:64,
示例19: CC_RETURN_IFvoid CATabBarController::tabBarSelectedItem(CATabBar* tabBar, CATabBarItem* item, unsigned int index){ CC_RETURN_IF(m_nSelectedIndex == index); this->showSelectedViewControllerAtIndex(index);}
开发者ID:Brian1900,项目名称:CrossApp,代码行数:5,
示例20: CC_RETURN_IFvoid CACollectionView::reloadData(){ CC_RETURN_IF(m_pCollectionViewDataSource == NULL); this->reloadViewSizeData(); this->removeAllSubviews(); DRect winRect = this->getBounds(); winRect.origin = getContentOffset(); float width = winRect.size.width; int y = 0; if (m_nCollectionHeaderHeight > 0 && m_pCollectionHeaderView) { m_pCollectionHeaderView->setDisplayRange(true); m_pCollectionHeaderView->setFrame(DRect(0, y, width, m_nCollectionHeaderHeight)); addSubview(m_pCollectionHeaderView); y += m_nCollectionHeaderHeight; } ; int begin = (int)m_rSectionRects.size(); m_rSectionRects.resize(m_rSectionRects.size() + m_nSections); for (int i = 0; i < m_nSections; i++) { unsigned int iSectionHeaderHeight = m_nSectionHeaderHeights.at(i); DRect sectionHeaderRect = DRect(0, y, width, iSectionHeaderHeight); if (iSectionHeaderHeight>0) { CAView* pSectionHeaderView = m_pCollectionViewDataSource->collectionViewSectionViewForHeaderInSection(this, sectionHeaderRect.size, i); if (pSectionHeaderView != NULL) { pSectionHeaderView->setDisplayRange(true); pSectionHeaderView->setFrame(sectionHeaderRect); insertSubview(pSectionHeaderView, 1); m_pSectionHeaderViews[i] = pSectionHeaderView; y += iSectionHeaderHeight; } } y += m_nVertInterval; unsigned int rowCount = m_nRowsInSections.at(i); for (int j = 0; j < rowCount; j++) { int iHeight = m_nRowHeightss.at(i).at(j); unsigned int itemCount = m_pCollectionViewDataSource->numberOfItemsInRowsInSection(this, i, j); unsigned int cellWidth = 0; if (itemCount>0) { cellWidth = (width - m_nHoriInterval) / itemCount - m_nHoriInterval; } for (int k = 0; k < itemCount; k++) { CAIndexPath3E indexPath = CAIndexPath3E(i, j, k); DRect cellRect = DRect(m_nHoriInterval + (cellWidth + m_nHoriInterval)*k, y, cellWidth, iHeight); m_rUsedCollectionCellRects[indexPath] = cellRect; std::pair<std::map<CAIndexPath3E, CACollectionViewCell*>::iterator, bool> itrResult = m_mpUsedCollectionCells.insert(std::make_pair(indexPath, (CACollectionViewCell*)NULL)); CC_CONTINUE_IF(!winRect.intersectsRect(cellRect)); CACollectionViewCell* cell = m_pCollectionViewDataSource->collectionCellAtIndex(this, cellRect.size, i, j, k); if (cell) { addSubview(cell); cell->setFrame(cellRect); cell->m_nSection = i; cell->m_nRow = j; cell->m_nItem = k; itrResult.first->second = cell; m_vpUsedCollectionCells.pushBack(cell); if (m_pCollectionViewDataSource) { m_pCollectionViewDataSource->collectionViewWillDisplayCellAtIndex(this, cell, i, j, k); } } } y += (iHeight + m_nVertInterval); } unsigned int iSectionFooterHeight = m_nSectionFooterHeights.at(i); DRect sectionFooterRect = DRect(0, y, width, iSectionFooterHeight); if (iSectionFooterHeight > 0) { CAView* pSectionFooterView = m_pCollectionViewDataSource->collectionViewSectionViewForFooterInSection(this, sectionFooterRect.size, i); if (pSectionFooterView != NULL) { pSectionFooterView->setDisplayRange(true); pSectionFooterView->setFrame(sectionFooterRect); insertSubview(pSectionFooterView, 1); m_pSectionFooterViews[i] = pSectionFooterView; y += iSectionFooterHeight; } } //.........这里部分代码省略.........
开发者ID:WoYang,项目名称:CrossApp,代码行数:101,
示例21: CCSizevoid CALabel::updateImage(){ int fontHeight = CAImage::getFontHeight(m_nfontName.c_str(), m_nfontSize); int defaultLineSpace = fontHeight / 4; unsigned int linenumber = (int)this->getBounds().size.height / fontHeight; CCSize size = CCSizeZero; if (m_bFitFlag) { float width = CAImage::getStringWidth(m_nfontName.c_str(), m_nfontSize, m_nText); if (width > m_obContentSize.width) { if (m_nNumberOfLine > 1) { size = CCSize(this->getBounds().size.width, (defaultLineSpace + m_iLineSpacing + fontHeight) * m_nNumberOfLine); } else if (m_nNumberOfLine == 1) { size = CCSize(width, fontHeight); } else { size.width = this->getBounds().size.width; size.height = CAImage::getStringHeight(m_nfontName.c_str(), m_nfontSize, m_nText, size.width, m_iLineSpacing, m_bWordWrap); } } else { size.height = fontHeight; size.width = width; } } else { if (linenumber == 0) { size = this->getBounds().size; } else { if (m_nNumberOfLine > 0) { size = CCSize(this->getBounds().size.width, (defaultLineSpace + m_iLineSpacing + fontHeight) * MIN(m_nNumberOfLine, linenumber)); } else { size = CCSize(this->getBounds().size.width, (defaultLineSpace + m_iLineSpacing + fontHeight) * linenumber); } } } CAImage* image = CAImage::createWithString(m_nText.c_str(), m_nfontName.c_str(), m_nfontSize, size, m_nTextAlignment, m_nVerticalTextAlignmet, m_bWordWrap, m_iLineSpacing, m_bBold, m_bItalics, m_bUnderLine); this->setImage(image); CC_RETURN_IF(image == NULL); m_cLabelSize = size; CCRect rect = CCRectZero; rect.size.width = this->getBounds().size.width; rect.size.height = size.height; float width = m_bFitFlag ? image->getContentSize().width : MIN(this->getBounds().size.width, image->getContentSize().width); rect.size.width = width; switch (m_nVerticalTextAlignmet) { case CAVerticalTextAlignmentTop: pTextHeight = 0; break; case CAVerticalTextAlignmentCenter: pTextHeight = (this->getBounds().size.height - rect.size.height) / 2; break; case CAVerticalTextAlignmentBottom: pTextHeight = this->getBounds().size.height - rect.size.height; break; default: break; } if (m_bFitFlag) { if (!size.equals(m_obContentSize))//.........这里部分代码省略.........
开发者ID:lmxing1987,项目名称:CrossApp,代码行数:101,
示例22: CC_RETURN_IFvoid CAButton::setControlState(const CAControlState& var){ CAControl::setControlState(var); CC_RETURN_IF(var == CAControlStateAll); for (int i=0; i<CAControlStateAll; i++) { this->removeSubview(m_pBackGroundView[i]); } m_eControlState = var; if (m_bControlStateLocked) { m_eControlState = CAControlStateNormal; } if (m_pBackGroundView[m_eControlState] && m_eControlState != CAControlStateNormal) { m_pBackGroundView[m_eControlState]->setFrame(this->getBounds()); this->insertSubview(m_pBackGroundView[m_eControlState], -1); } else if (m_pBackGroundView[CAControlStateNormal]) { m_pBackGroundView[CAControlStateNormal]->setFrame(this->getBounds()); this->insertSubview(m_pBackGroundView[CAControlStateNormal], -1); } if (m_eControlState == CAControlStateSelected) { m_bSelected = true; } else if(m_eControlState != CAControlStateHighlighted) { m_bSelected = false; } CAImage* image = NULL; std::string title = ""; CCRect imageViewCenter = CCRectZero; CCRect rect = CCRectZero; CCRect labelCenter = this->getBounds(); float labelSize = 0; image = m_pImage[m_eControlState]; title = m_sTitle[m_eControlState]; if (image == NULL) { image = this->isSelected() ? m_pImage[CAControlStateSelected] : m_pImage[CAControlStateNormal]; } if (strcmp(title.c_str(), "") == 0) { title = this->isSelected() ? m_sTitle[CAControlStateSelected] : m_sTitle[CAControlStateNormal]; } if (image && title.compare("") == 0) { CCSize size = this->getBounds().size; CCSize iSize = image->getContentSize(); float scaleX = size.width / iSize.width * 0.75f; float scaleY = size.height / iSize.height * 0.75f; float scale = MIN(scaleX, scaleY); scale = MIN(scale, 1.0f); iSize = ccpMult(iSize, scale); imageViewCenter.origin = size / 2; imageViewCenter.size = iSize; } else if (image == NULL && title.compare("") != 0) { labelSize = this->getBounds().size.height * 0.4f; labelCenter.origin = this->getBounds().size / 2 ; } else if (image && title.compare("") != 0) { CCSize size = this->getBounds().size; CCSize iSize = image->getContentSize(); float scaleX = size.width / iSize.width * 0.5f; float scaleY = size.height / iSize.height * 0.45f; float scale = MIN(scaleX, scaleY); scale = MIN(scale, 1.0f); iSize = ccpMult(iSize, scale); imageViewCenter.size = iSize; imageViewCenter.origin.x = size.width / 2; imageViewCenter.origin.y = size.height * 0.35f; labelSize = size.height * 0.2f; labelCenter.origin.x = size.width / 2; labelCenter.origin.y = size.height * 0.75f; } m_pImageView->setColor(m_sImageColor[m_eControlState]); m_pImageView->setCenter(imageViewCenter); if (image != m_pImageView->getImage()) {//.........这里部分代码省略.........
开发者ID:ancon,项目名称:CrossApp,代码行数:101,
示例23: CC_RETURN_IFvoid CAPageView::ccTouchEnded(CATouch *pTouch, CAEvent *pEvent){ CAScrollView::ccTouchEnded(pTouch, pEvent); CC_RETURN_IF(m_vTouches.size() > 1); if (m_ePageViewDirection == CAPageViewDirectionHorizontal) { float off_x = -m_tInertia.x; if (off_x > 0) { m_ePageViewState = Next; } else if (off_x < 0) { m_ePageViewState = Last; } else { m_ePageViewState = None; } } else { float off_y = -m_tInertia.y; if (off_y > 0) { m_ePageViewState = Next; } else if (off_y < 0) { m_ePageViewState = Last; } else { m_ePageViewState = None; } } int page = this->getCurrPage(); if (m_ePageViewState == Next) { page++; } else if (m_ePageViewState == Last) { page--; } else { if (m_ePageViewDirection == CAPageViewDirectionHorizontal) { float width = this->getBounds().size.width; float off_x = this->getContentOffset().x - this->getCurrPage() * width; if (off_x > width/2) { page++; } else if (off_x < -width/2) { page--; } } else { float height = this->getBounds().size.height; float off_y = this->getContentOffset().y - this->getCurrPage() * height; if (off_y > height/2) { page++; } else if (off_y < -height/2) { page--; } } } if (!pTouch->isDelta()) { if (m_pPageViewDelegate) { DPoint point = this->convertTouchToNodeSpace(pTouch); m_pPageViewDelegate->pageViewDidSelectPageAtIndex(this, this->getCurrPage(), point); } this->runAnimation(true); } else { page = MIN(page, (int)this->getPageCount() - 1); page = MAX(page, 0); this->setCurrPage(page, true, true); }}
开发者ID:wjm0729,项目名称:CrossApp,代码行数:97,
注:本文中的CC_RETURN_IF函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CC_RUNTIME_CLASS函数代码示例 C++ CC_RECT_POINTS_TO_PIXELS函数代码示例 |