这篇教程C++ CCRect函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CCRect函数的典型用法代码示例。如果您正苦于以下问题:C++ CCRect函数的具体用法?C++ CCRect怎么用?C++ CCRect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CCRect函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: switchvoid PatternMatrix::initProgressWithGameMode(){ mProgressBgSpr = CCSprite::create("ProgressBarBack.png"); mProgressBgSpr->setAnchorPoint(ccp(0, 0.5)); mProgressBgSpr->setPosition(ccp(35, mProgressBgSpr->getContentSize().height + 10)); this->addChild(mProgressBgSpr); mProgressSpr = CCSprite::create("ProgressBarFront.png"); switch(gGameMode) { case Timer: { mTimerTally = 0; mVisibleRect = CCRect(0, 0, 700, 52); break; } case Challenge: { mVisibleRect = CCRect(0,0,0,257); break; } } mProgressSpr->setPosition(ccp(35, mProgressBgSpr->getContentSize().height + 10)); mProgressSpr->setAnchorPoint(ccp(0, 0.5)); mProgressSpr->setTextureRect(mVisibleRect); this->addChild(mProgressSpr);}
开发者ID:github-zic,项目名称:FruitAttack_WP8,代码行数:30,
示例2: CAControl_selectorvoid SwitchTest::viewDidLoad(){ size = this->getView()->getBounds().size; CASwitch* defaultSwitch = CASwitch::createWithCenter(CCRect(size.width*0.5, size.height*0.2, size.width*0.3, 20)); defaultSwitch->setTag(100); defaultSwitch->addTarget(this,CAControl_selector(SwitchTest::switchStateChange)); this->getView()->addSubview(defaultSwitch); CASwitch* customSwitch = CASwitch::createWithCenter(CCRect(size.width*0.5, size.height*0.4, size.width*0.3, 20)); customSwitch->setTag(101); customSwitch->setOnImage(CAImage::create("source_material/btn_rounded_highlighted.png")); customSwitch->setOffImage(CAImage::create("source_material/btn_rounded_normal.png")); customSwitch->setThumbTintImage(CAImage::create("source_material/btn_rounded3D_selected.png")); customSwitch->addTarget(this, CAControl_selector(SwitchTest::switchStateChange)); this->getView()->addSubview(customSwitch); switchState = CALabel::createWithCenter(CCRect(size.width*0.5, size.height*0.6, size.width*0.5, 50)); switchState->setColor(CAColor_blueStyle); switchState->setText("Switch State:Off"); switchState->setFontSize(30 * CROSSAPP_ADPTATION_RATIO); switchState->setTextAlignment(CATextAlignmentCenter); switchState->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter); this->getView()->addSubview(switchState);}
开发者ID:ancon,项目名称:CrossApp,代码行数:25,
示例3: ccc4bool CAScrollView::initWithFrame(const cocos2d::CCRect &rect){ if (!CAView::initWithFrame(rect)) { return false; } this->setTouchEnabled(true); this->setDisplayRange(false); m_pContainer = CAView::createWithFrame(this->getBounds(), ccc4(255, 255, 255, 0)); m_pChildInThis->addObject(m_pContainer); this->addSubview(m_pContainer); m_pIndicatorHorizontal = CAIndicator::createWithFrame(CCRect(12, rect.size.height - 12, rect.size.width - 24, 10), CAIndicator::CAIndicatorTypeHorizontal); m_pChildInThis->addObject(m_pIndicatorHorizontal); this->insertSubview(m_pIndicatorHorizontal, 1); m_pIndicatorVertical = CAIndicator::createWithFrame(CCRect(rect.size.width - 12, 12, 10, rect.size.height - 24), CAIndicator::CAIndicatorTypeVertical); m_pChildInThis->addObject(m_pIndicatorVertical); this->insertSubview(m_pIndicatorVertical, 1); return true;}
开发者ID:chuzig,项目名称:CrossApp,代码行数:25,
示例4: _pxvoid CAScrollView::updateIndicator(){ if (m_pIndicatorHorizontal == NULL) { m_pIndicatorHorizontal = CAIndicator::create(CAIndicator::CAIndicatorTypeHorizontal); m_pChildInThis->addObject(m_pIndicatorHorizontal); this->insertSubview(m_pIndicatorHorizontal, 1); } if (m_pIndicatorVertical == NULL) { m_pIndicatorVertical = CAIndicator::create(CAIndicator::CAIndicatorTypeVertical); m_pChildInThis->addObject(m_pIndicatorVertical); this->insertSubview(m_pIndicatorVertical, 1); } const char indicatorSize = _px(6); const CCRect indicatorHorizontalFrame = CCRect(indicatorSize * 2, this->getBounds().size.height - indicatorSize * 2, this->getBounds().size.width - indicatorSize * 4, indicatorSize); m_pIndicatorHorizontal->setFrame(indicatorHorizontalFrame); const CCRect indicatorVerticalFrame = CCRect(this->getBounds().size.width - indicatorSize * 2, indicatorSize * 2, indicatorSize, this->getBounds().size.height - indicatorSize * 4); m_pIndicatorVertical->setFrame(indicatorVerticalFrame);}
开发者ID:khjl12345,项目名称:CrossApp,代码行数:30,
示例5: CCRectvoid HeroInfoController::loadTopBar(){ CCRect size_top = CCRect(0, 0, _size.width, _size.height / 4); CAView* _topView = CAView::createWithColor(CAColor_black); _topView->setFrame(size_top); this->getView()->addSubview(_topView); m_pLeftButton = CAButton::createWithFrame(CCRect(_px(10), _px(10), _px(60), _px(60)), CAButtonTypeCustom); m_pLeftButton->setBackGroundViewForState(CAControlStateNormal, CAImageView::createWithImage(CAImage::create("image/btn_left01"))); m_pLeftButton->setImageForState(CAControlStateNormal, CAImage::create("image/btn_left.png")); m_pLeftButton->setImageColorForState(CAControlStateHighlighted, CAColor_gray); m_pLeftButton->addTarget(this, CAControl_selector(HeroInfoController::setButton), CAControlEventTouchUpInSide); _topView->addSubview(m_pLeftButton); m_pHeadButton = CAButton::createWithCenter(CCRect(size_top.size.width / 2, size_top.size.height / 2, _px(100), _px(100)), CAButtonTypeCustom); m_pHeadButton->setImageForState(CAControlStateNormal, CAImage::create(hero->heroIMG)); m_pHeadButton->setImageColorForState(CAControlStateHighlighted, CAColor_red); _topView->addSubview(m_pHeadButton); CALabel* m_pHeadLabel = CALabel::createWithCenter(CCRect(size_top.size.width / 2, size_top.size.height / 2 + _px(100), _px(100), _px(100))); m_pHeadLabel->setTextAlignment(CATextAlignmentCenter); m_pHeadLabel->setBold(true); m_pHeadLabel->setFontSize(15); m_pHeadLabel->setText(UTF8ToGBK::transferToGbk(hero->heroName)); m_pHeadLabel->setColor(CAColor_white); _topView->addSubview(m_pHeadLabel);}
开发者ID:a752602882,项目名称:DotaMax,代码行数:29,
示例6: setFramevoid CATextSelectView::showTextSelView(const CCRect& rect, CAView* pControlView, bool showLeft, bool showRight){ if (getSuperview() != NULL) return; CCSize winSize = CAApplication::getApplication()->getWinSize(); setFrame(CCRect(0, 0, winSize.width, winSize.height)); setColor(CAColor_clear); setTextTag("CATextSelectView"); CCRect newRect = rect; if (showLeft) { m_pCursorMarkL->setFrame(CCRect(newRect.origin.x - CATextSelectArrWidth, newRect.origin.y + newRect.size.height, CATextSelectArrWidth, CATextSelectArrHeight)); m_pCursorMarkL->setVisible(true); } if (showRight) { m_pCursorMarkR->setFrame(CCRect(newRect.origin.x + newRect.size.width, newRect.origin.y + newRect.size.height, CATextSelectArrWidth, CATextSelectArrHeight)); m_pCursorMarkR->setVisible(true); } m_pTextViewMask->setFrame(newRect); m_pTextViewMask->setVisible(true); if (CAView *rootWindow = CAApplication::getApplication()->getRootWindow()) { rootWindow->removeSubviewByTextTag("CATextSelectView"); rootWindow->addSubview(this); } becomeFirstResponder(); m_pControlView = pControlView;}
开发者ID:garyyyy,项目名称:CrossApp,代码行数:35,
示例7: _pxvoid registerViewController::loadDisButton(CCSize _size, int _lineHeight){ CAButton* button1 = CAButton::createWithFrame(CCRect(-1, 10 + _lineHeight, _size.width / 5, _px(50)), CAButtonTypeCustom); button1->setAllowsSelected(false); CAScale9ImageView* imageView = CAScale9ImageView::createWithImage(CAImage::create("image/bg.png")); button1->setBackGroundViewForState(CAControlStateAll, imageView); this->getView()->addSubview(button1); CAView* view1 = CAView::createWithFrame(CCRect(-1, 11 + _lineHeight, _size.width / 5 - 1, _px(48))); view1->setColor(ccc4(220, 220, 220, 250)); this->getView()->addSubview(view1); CALabel* label = CALabel::createWithCenter(view1->getCenter()); label->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter); label->setTextAlignment(CATextAlignmentCenter); label->setFontSize(_px(20)); if (_lineHeight==0) { label->setText("+86"); } else{ label->setText(UTF8("邀请码")); } this->getView()->addSubview(label);}
开发者ID:a752602882,项目名称:DotaMax,代码行数:27,
示例8: CCRectvoid CADrawerController::viewDidLoad(){ m_rHideFrame[0] = CCRect(-m_fDivision, 0, m_fDivision, this->getView()->getBounds().size.height); m_rHideFrame[1] = CCRect(0 , 0, this->getView()->getBounds().size.width, this->getView()->getBounds().size.height); m_rShowFrame[0] = CCRect(0, 0, m_fDivision, this->getView()->getBounds().size.height); m_rShowFrame[1] = CCRect(m_fDivision , 0, this->getView()->getBounds().size.width, this->getView()->getBounds().size.height); for (int i=0; i<2; i++) { m_pContainer[i] = new CAView(); m_pContainer[i]->setFrame(m_rHideFrame[i]); this->getView()->addSubview(m_pContainer[i]); m_pContainer[i]->release(); } m_pContainer[0]->setAnchorPoint(CCPoint(1.0f, 0.5f)); m_pContainer[1]->setAnchorPoint(CCPoint(0.0f, 0.5f)); m_pLeftViewController->addViewFromSuperview(m_pContainer[0]); m_pRightViewController->addViewFromSuperview(m_pContainer[1]); m_bShow = true; this->hideLeftViewController(false); if (m_pBackgroundView) { m_pBackgroundView->setFrame(this->getView()->getBounds()); }}
开发者ID:Super-Man,项目名称:CrossApp,代码行数:30,
示例9: CATableViewvoid RootViewController::viewDidLoad(){ CCRect rect = this->getView()->getBounds(); CCRect tableRect = rect; tableRect.size.height = rect.size.height - 80; tableView = new CATableView(); tableView->initWithFrame(tableRect); tableView->setTableViewDataSource(this); tableView->setTableViewDelegate(this); this->getView()->addSubview(tableView); tableView->release(); CAImageView* v = CAImageView::createWithImage(CAImage::create("2.jpg")); tableView->setTableHeaderHeight(400); tableView->setTableHeaderView(v); CAView* v2 = CAView::createWithFrame(CCRectZero, ccc4(80, 80, 180, 255)); tableView->setTableFooterHeight(200); tableView->setTableFooterView(v2); CAView* s = CAView::createWithFrame(CCRectZero, ccc4(127, 127, 127, 127)); tableView->setTablePullDownView(s); tableView->setTablePullViewHeight(200); tableView->setBackGroundImage(CAImage::create("bg.jpg")); CAButton* btn1 = CAButton::createWithFrame(CCRect(10, tableRect.size.height+10, 240, 60)); btn1->setView(CAControlStateNormal, CCLabelTTF::create("unSelected", "Arial", 30)); btn1->setView(CAControlStateSelected, CCLabelTTF::create("selected", "Arial", 30)); btn1->getView(CAControlStateNormal)->setColor(ccBLACK); btn1->getView(CAControlStateSelected)->setColor(ccBLACK); this->getView()->addSubview(btn1); btn1->addTarget(this, CAButton_selector(RootViewController::setAllowsSelection), TouchUpInSide); btn1->setAllowsSelected(true); CAButton* btn2 = CAButton::createWithFrame(CCRect(260, tableRect.size.height+10, 240, 60)); btn2->setView(CAControlStateNormal, CCLabelTTF::create("unAllowsMultiple", "Arial", 30)); btn2->setView(CAControlStateSelected, CCLabelTTF::create("allowsMultiple", "Arial", 30)); btn2->getView(CAControlStateNormal)->setColor(ccBLACK); btn2->getView(CAControlStateSelected)->setColor(ccBLACK); this->getView()->addSubview(btn2); btn2->addTarget(this, CAButton_selector(RootViewController::setAllowsMultipleSelection), TouchUpInSide); btn2->setAllowsSelected(true); progress = CAProgress::create(); progress->setFrame(CCRect(520, tableRect.size.height+10, 200, 16)); this->getView()->addSubview(progress); progress->setProgress(0.5f); CAScheduler::schedule(schedule_selector(RootViewController::updateProgress), this, 5, false);}
开发者ID:tangyijie,项目名称:CrossApp,代码行数:55,
示例10: CCRectvoid HoldOnGame::checkCollision(){ //小球与障碍物 CCRect ballRect = playerBall->boundingBox(); CCRect rect = CCRect(ballRect.origin.x + KBallOffset, ballRect.origin.y + KBallOffset, ballRect.size.width - KBallOffset * 2, ballRect.size.height - KBallOffset * 2); for (int i = KBodyTypeRectangleVer; i <= KBodyTypeSquare; i++) { CCSprite* sprite = (CCSprite*)gameLayer->getChildByTag(i); if (rect.intersectsRect(sprite->boundingBox())) { bool over = true; if (sprite->getTag() == KBodyTypeTriangle) { CCRect sRect = sprite->boundingBox(); CCRect rect1 = CCRect(sRect.origin.x + (sRect.size.width * 0.25) / 2 + KBallOffset, sRect.origin.y, sRect.size.width * 0.75 - KBallOffset * 2, sRect.size.height * 0.25); if (!rect.intersectsRect(rect1)) { rect1 = CCRect(sRect.origin.x + sRect.size.width * 0.25 + KBallOffset, sRect.origin.y + sRect.size.height * 0.25, sRect.size.width * 0.5 - KBallOffset * 2, sRect.size.height * 0.25); if (!rect.intersectsRect(rect1)) { rect1 = CCRect(sRect.origin.x + sRect.size.width * 3 / 8 + KBallOffset, sRect.origin.y + sRect.size.height * 0.5, sRect.size.width * 0.25 - KBallOffset* 2, sRect.size.height * 0.25); if (!rect.intersectsRect(rect1)) { rect1 = CCRect(sRect.origin.x + sRect.size.width * 0.45, sRect.origin.y + sRect.size.height * 0.75, sRect.size.width * 0.1, sRect.size.height * 0.15); if (!rect.intersectsRect(rect1)) { over = false; } else { CCLOG("44444 rect1 = (%.1f, %.1f, %.1f, %.1f)", rect1.origin.x, rect1.origin.y, rect1.size.width, rect1.size.height); } } else { CCLOG("333333 rect1 = (%.1f, %.1f, %.1f, %.1f)", rect1.origin.x, rect1.origin.y, rect1.size.width, rect1.size.height); } } else { CCLOG("22222222 rect1 = (%.1f, %.1f, %.1f, %.1f)", rect1.origin.x, rect1.origin.y, rect1.size.width, rect1.size.height); } } else { CCLOG("1111111 rect1 = (%.1f, %.1f, %.1f, %.1f)", rect1.origin.x, rect1.origin.y, rect1.size.width, rect1.size.height); } // if (over) {// CCLOG("rect = (%.1f, %.1f, %.1f, %.1f)", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);// CCLOG("sRect = (%.1f, %.1f, %.1f, %.1f)", sRect.origin.x, sRect.origin.y, sRect.size.width, sRect.size.height);// CCLOG("game over");//// this->gameOver();// break;// } } if (over) { this->gameOver(); break; } } }}
开发者ID:lkeplei,项目名称:HoldOnGame,代码行数:54,
示例11: ccc4CAView* RootViewController::tableViewSectionViewForFooterInSection(CATableView* table, unsigned int section){ CAView* view = CAView::createWithFrame(CCRect(0, 0, 0, 0), ccc4(200, 255, 200, 255)); CCString* str = CCString::createWithFormat("Footer - %u", section); CCLabelTTF* ttf = CCLabelTTF::create(str->getCString(), "Arial", 20); ttf->setColor(ccc3(127, 127, 127)); ttf->setFrame(CCRect(10, 10, 0, 0)); view->addSubview(ttf); return view;}
开发者ID:tangyijie,项目名称:CrossApp,代码行数:12,
示例12: copyPoker* Poker::copy(){ Poker* pk; if(m_huaSe != Gui) pk = Poker::create("poker.png",CCRect(this->m_num*pkWidth,this->m_huaSe*pkHeight,pkWidth,pkHeight)); else pk = Poker::create("poker.png",CCRect((this->m_num-XiaoGui)*pkWidth,this->m_huaSe*pkHeight,pkWidth,pkHeight)); pk->m_isDianJi = this->m_isDianJi; pk->m_isSelect = this->m_isSelect; pk->setHuaSe(this->getHuaSe()); pk->setNum(this->getNum()); pk->m_gameMain = this->m_gameMain; return pk;}
开发者ID:oiy37215,项目名称:doudizhu,代码行数:13,
示例13: viewDidLoadvoid FirstViewController::viewDidLoad(){ // Do any additional setup after loading the view from its nib. CAImageView* imageView = CAImageView::createWithImage(CAImage::create("9m.jpg")); imageView->setFrame(CCRect(200, 300, 330, 214)); this->getView()->addSubview(imageView); CCLabelTTF* ttf = CCLabelTTF::create("Hello World!", "Arial", 50); ttf->setColor(ccBLACK); ttf->setFrame(CCRect(200, 450, 0, 0)); this->getView()->addSubview(ttf);}
开发者ID:Jimlan,项目名称:CrossApp,代码行数:13,
示例14: TMenuItemImageCCMenuItemImage* TMenuItemImage::create(const char *img, CCObject* target, SEL_MenuHandler selector){ CCMenuItemImage *pRet = new TMenuItemImage(); CCTexture2D* ptex = CCTextureCache::sharedTextureCache()->addImage( img ); int tw = ptex->getContentSize().width / 4; int th = ptex->getContentSize().height; CCNode* normal = CCSprite::createWithTexture( ptex, CCRect(0, 0, tw, th ) ); CCNode *selected = CCSprite::createWithTexture(ptex, CCRect( tw*2, 0, tw, th) ); CCNode *disabled = CCSprite::createWithTexture( ptex, CCRect( tw*3, 0, tw, th) ); pRet->initWithNormalSprite(normal, selected, disabled, target, selector); pRet->autorelease(); return pRet;}
开发者ID:Coolxiaoo,项目名称:tui,代码行数:13,
示例15: ccc4CAView* ThirdViewController::collectionViewSectionViewForHeaderInSection(CACollectionView *collectionView, const CCSize& viewSize, unsigned int section){ CAView* view = CAView::createWithFrame(CCRect(0, 0, 0, 0), ccc4(224, 224, 224, 255)); CCString* str = CCString::createWithFormat("Section Header - %u", section); CALabel* label = CALabel::createWithFrame(CCRect(20, 0, 200, viewSize.height)); label->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter); label->setFontSize(24); label->setText(str->getCString()); label->setColor(ccc4(127, 127, 127, 255)); view->addSubview(label); return view;}
开发者ID:JasonWorking,项目名称:CrossApp,代码行数:14,
示例16: setContentSizevoid CAScrollView::setContentSize(const cocos2d::CCSize &var){ CAView::setContentSize(var); if (m_pIndicatorHorizontal) { m_pIndicatorHorizontal->setFrame(CCRect(12, var.height - 12, var.width - 24, 10)); } if (m_pIndicatorVertical) { m_pIndicatorVertical->setFrame(CCRect(var.width - 12, 12, 10, var.height - 24)); } this->update(0);}
开发者ID:chengjunjian,项目名称:CrossApp,代码行数:14,
示例17: _pxvoid UtilManager::toast(string text, string image, bool isSmall) { CAApplication::getApplication()->getRootWindow()->removeSubviewByTag(TOAST_VIEW_TAG); CCSize winSize = CAApplication::getApplication()->getWinSize(); CAImageView *back = CAImageView::create(); if (isSmall == false) { //CAView *back = CAView::createWithCenter(CCRect(winSize.width*0.5, winSize.height*0.5, _dip(winSize.width)*0.3, _dip(winSize.height)*0.3)); back->setCenter(CCRect(winSize.width*0.5, winSize.height*0.55, _px(120), _px(120))); } else { back->setCenter(CCRect(winSize.width*0.5, winSize.height*0.4, _px(120), _px(120))); } back->setTag(TOAST_VIEW_TAG); back->setImage(CAImage::create("image/scape_storage.png")); //back->setColor(ccc4(31, 31, 31, 200));//40 CALabel *title = CALabel::createWithCenter(CADipRect(_dip(back->getBounds().size.width*0.5), _dip(back->getBounds().size.height*0.8), 100, 100)); //title->setText(UTF8ToGBK::transferToGbk(text)); //title->setFontName(getChineseFont()); title->setColor(CAColor_white); title->setTextAlignment(CATextAlignmentCenter); title->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter); title->setFontSize(_px(22)); back->addSubview(title); CAImageView *icon = CAImageView::create(); if (isSmall == false) { //CAView *back = CAView::createWithCenter(CCRect(winSize.width*0.5, winSize.height*0.5, _dip(winSize.width)*0.3, _dip(winSize.height)*0.3)); icon->setCenter(CADipRect(_dip(back->getBounds().size.width*0.5), _dip(back->getBounds().size.height*0.4), 90 / 1.5, 68 / 1.5)); } else { icon->setCenter(CADipRect(_dip(back->getBounds().size.width*0.5), _dip(back->getBounds().size.height*0.4), 72 / 1.5, 72 / 1.5)); } //CAImageView *icon = CAImageView::createWithCenter(CADipRect(_dip(back->getBounds().size.width*0.5),_dip(back->getBounds().size.height*0.4), 105/1.5, 95/1.5)); icon->setImage(CAImage::create(image)); back->addSubview(icon); CAApplication::getApplication()->getRootWindow()->addSubview(back); //CCLog("%s", get_date_now().c_str()); icon->runAction(CCSequence::createWithTwoActions(CCDelayTime::create(0.3), CCFadeOut::create(TOAST_TIME / 2.0))); back->runAction(CCSequence::createWithTwoActions(CCDelayTime::create(0.3), CCFadeOut::create(TOAST_TIME))); scheduleOnce(schedule_selector(UtilManager::removeToast), this, TOAST_TIME);}
开发者ID:a752602882,项目名称:DotaMax,代码行数:48,
示例18: getContentOffsetvoid CAListView::reloadViewSizeData(){ CCRect winRect = this->getBounds(); winRect.origin = getContentOffset(); float width = winRect.size.width; float height = winRect.size.height; clearData(); int iStartPosition = 0; if (m_nListHeaderHeight > 0) { m_rHeaderRect = (m_pListViewOrientation == CAListViewOrientationVertical) ? CCRect(0, iStartPosition, width, m_nListHeaderHeight) : CCRect(iStartPosition, 0, m_nListHeaderHeight, height); iStartPosition += m_nListHeaderHeight; } m_nIndexs = m_pListViewDataSource->numberOfIndex(this); m_rIndexRects.resize(m_nIndexs); m_rLineRects.resize(m_nIndexs); for (unsigned i = 0; i < m_nIndexs; i++) { unsigned int cellHeight = m_pListViewDataSource->listViewHeightForIndex(this, i); if (cellHeight > 0) { CCRect cellRect = (m_pListViewOrientation == CAListViewOrientationVertical) ? CCRect(0, iStartPosition, width, cellHeight) : CCRect(iStartPosition, 0, cellHeight, height); m_rIndexRects[i] = cellRect; iStartPosition += cellHeight; } if (m_nSeparatorViewHeight > 0) { m_rLineRects[i] = (m_pListViewOrientation == CAListViewOrientationVertical) ? CCRect(0, iStartPosition, width, m_nSeparatorViewHeight) : CCRect(iStartPosition, 0, m_nSeparatorViewHeight, height); iStartPosition += m_nSeparatorViewHeight; } } if (m_nListFooterHeight > 0) { m_rFooterRect = (m_pListViewOrientation == CAListViewOrientationVertical) ? CCRect(0, iStartPosition, width, m_nListFooterHeight) : CCRect(iStartPosition, 0, m_nListFooterHeight, height); iStartPosition += m_nListFooterHeight; } if (m_pListViewOrientation == CAListViewOrientationVertical) { this->setViewSize(CCSize(width, iStartPosition)); } else { this->setViewSize(CCSize(iStartPosition, height)); }}
开发者ID:JoKaWare,项目名称:CrossApp,代码行数:58,
示例19: CCRectvoid CC3Layer::updateViewport(){ CCSize viewSize = CCDirector::sharedDirector()->getWinSizeInPixels(); CCRect gbb = CCRect(0, 0, viewSize.width, viewSize.height); // Check whether the viewport covers the full UIView. bool isFullView = gbb.origin.equals(CCPointZero) && gbb.size.equals(viewSize); // Convert the bounds of this layer to a viewport CC3Viewport vp = CC3ViewportFromCGRect(gbb); // Set the viewport into the view surface and the camera if ( m_pSurfaceManager ) { m_pSurfaceManager->setViewSurfaceOrigin( vp.origin ); m_pSurfaceManager->setSize( vp.size ); } CC3Scene* scene = getCC3Scene(); if ( scene ) { CC3Camera* cam = scene->getActiveCamera(); if ( cam ) { cam->setViewport( vp ); cam->setShouldClipToViewport( !isFullView ); } } #pragma _NOTE_TODO( "update cocos2d viewport" ) // super::updateViewport();}
开发者ID:HerdiandKun,项目名称:cocos3d-x,代码行数:33,
示例20: CCRectCCRect Enemy::getBoundingBox(){ CCRect rect = _sprite->boundingBox(); CCPoint pos = this->convertToWorldSpace(rect.origin); CCRect enenyRect = CCRect(pos.x, pos.y, rect.size.width, rect.size.height); return enenyRect;}
开发者ID:whuhan2013,项目名称:Plane,代码行数:7,
示例21: thirdTabBarvoid TabBarTest::thirdTabBar(){ CATabBarItem* item1 = CATabBarItem::create("Edit", CAImage::create("tabbar_function/first_1.png"), CAImage::create("tabbar_function/first_2.png")); CATabBarItem* item2 = CATabBarItem::create("Friends", CAImage::create("tabbar_function/second_1.png"), CAImage::create("tabbar_function/second_2.png")); CATabBarItem* item3 = CATabBarItem::create("Message", CAImage::create("tabbar_function/third_1.png"), CAImage::create("tabbar_function/third_2.png")); CATabBarItem* item4 = CATabBarItem::create("Search", CAImage::create("tabbar_function/fourth_1.png"), CAImage::create("tabbar_function/fourth_2.png")); CATabBarItem* item5 = CATabBarItem::create("Setting", CAImage::create("tabbar_function/fifth_1.png"), CAImage::create("tabbar_function/fifth_2.png")); std::vector<CATabBarItem*> item; item.push_back(item1); item.push_back(item2); item.push_back(item3); item.push_back(item4); item.push_back(item5); CATabBar* tabBar = CATabBar::create(item); tabBar->setCenter(CCRect(size.width*0.5, size.height*0.5 - 200, size.width, 100)); tabBar->showSelectedIndicator(); tabBar->setTitleColorForNormal(CAColor_yellow); tabBar->setTitleColorForSelected(CAColor_orange); tabBar->setSelectedBackGroundImage(CAImage::create("source_material/alert_btn.png")); tabBar->setMaxShowCount(3); tabBar->setDelegate(this); this->getView()->addSubview(tabBar); tabBar->setSelectedAtIndex(1);}
开发者ID:ancon,项目名称:CrossApp,代码行数:26,
示例22: createWithFramevoid CATextToolBarView::addGrayLine(int x){ CCSize size = CAApplication::getApplication()->getWinSize(); CAView *line = createWithFrame(CCRect(x, 0, 1, size.height)); line->setColor(ccc4(206, 206, 211, 255)); m_pBackView->addSubview(line);}
开发者ID:garyyyy,项目名称:CrossApp,代码行数:7,
示例23: CCRectvoid CATabBar::showSelectedIndicator(){ if (m_pSelectedIndicator) { m_pSelectedIndicator->removeFromSuperview(); m_pSelectedIndicator=NULL; } if (m_pSelectedIndicatorImage == NULL) { m_pSelectedIndicatorImage = CAImage::create("source_material/tabBar_selected_indicator.png"); } CCRect rect = CCRect(0, this->getBounds().size.height, m_cItemSize.width, m_cItemSize.height / 10); CAScale9ImageView* selectedIndicator= CAScale9ImageView::createWithImage(m_pSelectedIndicatorImage); CCRect insetRect; insetRect.origin = selectedIndicator->getBounds().size / 2; insetRect.origin = ccpSub(insetRect.origin, CCPoint(1, 1)); insetRect.size = CCPoint(2, 2); selectedIndicator->setCapInsets(insetRect); selectedIndicator->setFrame(rect); this->insertSubview(selectedIndicator, 1); m_pSelectedIndicator = selectedIndicator;}
开发者ID:JasonWorking,项目名称:CrossApp,代码行数:28,
示例24: m_instantMoveFMUISpin::FMUISpin():m_instantMove(false),m_parentNode(NULL),m_list(NULL),m_tiers(NULL),m_timesLabel(NULL),m_moreSpinBtn(NULL),m_lever(NULL),m_leverBar(NULL),m_leverBall(NULL),m_isSpin(false),m_isLeverTouch(false),m_titleLabel(NULL),m_spinGuide(NULL){ m_list = CCArray::create(); m_list->retain(); m_tiers = CCArray::create(); m_tiers->retain(); m_ccbNode = FMDataManager::sharedManager()->createNode("UI/FMUISpin.ccbi", this); addChild(m_ccbNode); CCSize cullingSize = CCSize(78, 180); GUISpinView * spin = new GUISpinView(CCRect(-cullingSize.width * 0.5f, -cullingSize.height * 0.5f + 5.f, cullingSize.width, cullingSize.height), 42.f, this); spin->setPosition(ccp(0.f, -5.f)); m_spinView = spin; m_parentNode->addChild(m_spinView, 10); CCNode * node = m_parentNode->getChildByTag(1); node->setZOrder(100);}
开发者ID:rockingdice,项目名称:IceCreamJam,代码行数:33,
示例25: CCLogbool TetrisGameLayer::init(void){ if (!CCLayer::init()) { return false; } _sharedTetrisGameLayer = this; CCSize size = CCDirector::sharedDirector()->getWinSize(); CCLog("size_width:%f_height:%f",size.width,size.height); int cl = 20; float width = size.width/20; int row = (size.height-50)/width; TetrisDateHandle * datehandle = TetrisDateHandle::getSharedTetrisDateHandle(); CCSize cs = CCSizeMake(width, width); _c = cl;_r = row; _w = width;_h=width; datehandle->initWithT_C_R(cl, row, cs); drawRect = CCRect(20, 50, (cl-1)*width, row*width); G_B_blockParent = CCNode::create(); G_B_blockParent->setAnchorPoint(ccp(0, 0)); G_B_blockParent->setPosition(ccp(0, 0)); this->addChild(G_B_blockParent); return true;}
开发者ID:zzh442856860,项目名称:eluosi,代码行数:33,
示例26: CCRectBall::Ball(const char *filename, b2World *world){ this->initWithFile(filename, CCRect(0, 0, 74, 70)); //this->autorelease(); b2CircleShape circleShape = b2CircleShape(); circleShape.m_radius = 2.25f/2.0f; b2FixtureDef bodyFixDef; bodyFixDef.shape = &circleShape; bodyFixDef.density = 1.0f; bodyFixDef.friction = 0.0f; bodyFixDef.restitution = 1.0f; b2BodyDef bDef; bDef.position.x = tob2d(60); bDef.position.y = tob2d(540); bDef.allowSleep = false; bDef.fixedRotation = true; bDef.type = b2_dynamicBody; bDef.userData = this; this->body = world->CreateBody(&bDef); this->body->CreateFixture(&bodyFixDef);}
开发者ID:amrzagloul,项目名称:BBB,代码行数:25,
示例27: CCRectvoid DMChartsController::initWithTableView(){ CCRect tableR = CCRect(0, _px(96), this->getView()->getFrame().size.width, this->getView()->getFrame().size.height-_px(96)); //总榜 m_pTableView = CATableView::createWithFrame(tableR); m_pTableView->setTableViewDataSource(this); m_pTableView->setTableViewDelegate(this); m_pTableView->setAllowsSelection(true); this->getView()->addSubview(m_pTableView); //月榜 m_pMonthView = CATableView::createWithFrame(tableR); m_pMonthView->setTableViewDataSource(this); m_pMonthView->setTableViewDelegate(this); m_pMonthView->setAllowsSelection(true); m_pMonthView->setVisible(false); this->getView()->addSubview(m_pMonthView); //周榜 m_pmWeekView = CATableView::createWithFrame(tableR); m_pmWeekView->setTableViewDataSource(this); m_pmWeekView->setTableViewDelegate(this); m_pmWeekView->setAllowsSelection(true); m_pmWeekView->setVisible(false); this->getView()->addSubview(m_pmWeekView); m_pCurrTableViews.push_back(m_pTableView); m_pCurrTableViews.push_back(m_pMonthView); m_pCurrTableViews.push_back(m_pmWeekView);}
开发者ID:rvpoochen,项目名称:CartoonHouse,代码行数:28,
示例28: CCRectCCRect PropertyInput::GetRangeRect(){ CCPoint start = this->text->getPosition(); CCRect rect = CCRect(start.x, start.y, this->inputRect.width, this->inputRect.height); return rect;}
开发者ID:Whislly,项目名称:DreamBookToolbox,代码行数:7,
注:本文中的CCRect函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CCRectMake函数代码示例 C++ CCRANDOM_0_1函数代码示例 |