您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CCSize函数代码示例

51自学网 2021-06-01 19:57:29
  C++
这篇教程C++ CCSize函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CCSize函数的典型用法代码示例。如果您正苦于以下问题:C++ CCSize函数的具体用法?C++ CCSize怎么用?C++ CCSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了CCSize函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: CCSize

void CCSReader::setPropsForTextAreaFromJsonDictionary(CocoWidget*widget,cs::CSJsonDictionary* options){    this->setPropsForWidgetFromJsonDictionary(widget, options);    CocoTextArea* textArea = (CocoTextArea*)widget;    textArea->setText(DICTOOL->getStringValue_json(options, "text"));    bool fs = DICTOOL->checkObjectExist_json(options, "fontSize");    if (fs)    {        textArea->setFontSize(DICTOOL->getIntValue_json(options, "fontSize"));    }    int cr = DICTOOL->getIntValue_json(options, "colorR");    int cg = DICTOOL->getIntValue_json(options, "colorG");    int cb = DICTOOL->getIntValue_json(options, "colorB");    textArea->setTextColor(cr, cg, cb);    textArea->setFontName(DICTOOL->getStringValue_json(options, "fontName"));    bool aw = DICTOOL->checkObjectExist_json(options, "areaWidth");    bool ah = DICTOOL->checkObjectExist_json(options, "areaHeight");    if (aw && ah)    {        CCSize size = CCSize(DICTOOL->getFloatValue_json(options, "areaWidth"),DICTOOL->getFloatValue_json(options,"areaHeight"));        textArea->setTextAreaSize(size);    }    bool ha = DICTOOL->checkObjectExist_json(options, "hAlignment");    if (ha)    {        textArea->setTextHorizontalAlignment((cocos2d::CCTextAlignment)DICTOOL->getIntValue_json(options, "hAlignment"));    }    bool va = DICTOOL->checkObjectExist_json(options, "vAlignment");    if (va)    {        textArea->setTextVerticalAlignment((cocos2d::CCVerticalTextAlignment)DICTOOL->getIntValue_json(options, "vAlignment"));    }    this->setColorPropsForWidgetFromJsonDictionary(widget,options);}
开发者ID:pipu,项目名称:Cocos2d-x-For-CocoStudio,代码行数:34,


示例2: initialization

void GameBackground::initialization(){    GameBackgroundGradientDelegate::initialization();    this->setContentSize(CCSize(Options::CAMERA_WIDTH, Options::CAMERA_HEIGHT - this->mDesignedSize - (Options::CAMERA_WIDTH - (this->mDesignedSize - this->mDesigneddoublePaddingSize))));    this->setCenterPosition(Options::CAMERA_CENTER_X, Options::CAMERA_HEIGHT - this->getHeight() / 2);}
开发者ID:tooflya,项目名称:beat-my-robo,代码行数:7,


示例3: init

bool UpdateLayer::init(){	if(!CCLayer::init())		return false;	CCSprite* bg = CCSprite::create("Res/Update/progress_bg.png");	CCSprite* tActor = CCSprite::create("Res/Update/progress_tile.png");	bg->setPosition(ccp(SCREEN_WIDTH/2,200));	m_BarProgress = CCProgressTimer::create(tActor);	m_BarProgress->setAnchorPoint(CCPointZero);	m_BarProgress->setPosition(bg->getPosition().x - tActor->getContentSize().width/2, bg->getPosition().y-tActor->getContentSize().height/2);	m_BarProgress->setType(kCCProgressTimerTypeBar);	m_BarProgress->setMidpoint(ccp(0, 0));	m_BarProgress->setBarChangeRate(ccp(1, 0));	m_BarProgress->setPercentage(0);	m_BarProgress->setVisible(false);	this->addChild(m_BarProgress);	this->addChild(bg);	m_countLabel = CCLabelTTF::create("","",25,CCSize(100,50),kCCTextAlignmentLeft);	m_countLabel->setAnchorPoint(ccp(0,0.5));	m_countLabel->setPosition(ccp(bg->getPosition().x+bg->getContentSize().width,bg->getPosition().y));	this->addChild(m_countLabel);	AutoUpdate::getInstance()->AutoUpdateVersion(this,updatecallback_selector(UpdateLayer::UpdateState));	schedule(schedule_selector(UpdateLayer::Update));	return true;}
开发者ID:quinsmpang,项目名称:LDClient-src-and-scrips,代码行数:25,


示例4: setTitle

bool CButtonChangeSizeTest::init(){	CButtonTestSceneBase::init();	setTitle("CButtonChangeSizeTest");	setDescription("click the button for change anothor one");	m_lData.push_back("a");	m_lData.push_back("ab");	m_lData.push_back("abc");	m_lData.push_back("abcd");	m_lData.push_back("abcde");	m_lData.push_back("abcdef");	m_lData.push_back("abcdefg");	m_lData.push_back("abcdefgi");	m_lData.push_back("abcdefgj");	m_lData.push_back("hahahahaha/nhehehehehe");	m_lData.push_back("hahahahaha/nhehehehehe/nkukukukukukukuku");	m_pButton = CButton::create();	m_pButton->setScale9Enabled(true);	m_pButton->setNormalImage("sprite9_btn1.png");	m_pButton->setSelectedImage("sprite9_btn2.png");	m_pButton->initText("none", "", 30.0f);	m_pButton->setCascadeTextSizeEnabled(true, CCSize(50, 30));	m_pButton->setPosition(CCPoint(480, 320));	m_pWindow->addChild(m_pButton);	CButton* pBtn = CButton::createWith9Sprite(CCSizeMake(150, 50), "sprite9_btn1.png", "sprite9_btn2.png");	pBtn->setPosition(CCPoint(250, 320));	pBtn->initText("click me", "", 27.0f);	pBtn->setOnClickListener(this, ccw_click_selector(CButtonChangeSizeTest::onClick));	m_pWindow->addChild(pBtn);	return true;}
开发者ID:Coolxiaoo,项目名称:CocosWidget,代码行数:35,


示例5: CC_RETURN_IF

void CATabBar::setSelectedAtIndex(int index){    CC_RETURN_IF(index < 0);    CC_RETURN_IF(index >= m_pItems.size());        m_nSelectedIndex = index;    m_pSelectedItem = m_pItems.at(m_nSelectedIndex);        CC_RETURN_IF(!m_bRunning);        if (m_pSelectedIndicator)    {        CCRect rect = m_pSelectedIndicator->getFrame();        rect.size = CCSize(m_cItemSize.width, m_cItemSize.height / 10);        ((CAScale9ImageView*)m_pSelectedIndicator)->setFrame(rect);        m_pSelectedIndicator->stopAllActions();        CCPoint p = m_cItemSize;        p.y -= m_pSelectedIndicator->getFrame().size.height;        p.x *= m_nSelectedIndex;        CCFrameOrginTo* moveTo = CCFrameOrginTo::create(0.3f, p);        CCEaseSineOut* easeBack = CCEaseSineOut::create(moveTo);        m_pSelectedIndicator->runAction(easeBack);    }        m_pSegmentedControl->setSelectedAtIndex(index);    m_pDelegate->tabBarSelectedItem(this, m_pSelectedItem, m_nSelectedIndex);}
开发者ID:AojiaoZero,项目名称:CrossApp,代码行数:27,


示例6: setPercent

void Slider::setPercent(int percent){    if (percent > 100)    {        percent = 100;    }    if (percent < 0)    {        percent = 0;    }    _percent = percent;    float res = percent/100.0f;    float dis = _barLength * res;    _slidBallRenderer->setPosition(CCPoint(-_barLength/2.0f + dis, 0.0f));    if (_scale9Enabled)    {        static_cast<CCScale9Sprite*>(_progressBarRenderer)->setPreferredSize(CCSize(dis,_progressBarTextureSize.height));    }    else    {        CCSprite* spriteRenderer = static_cast<CCSprite*>(_progressBarRenderer);        CCRect rect = spriteRenderer->getTextureRect();        rect.size.width = _progressBarTextureSize.width * res;        spriteRenderer->setTextureRect(rect, spriteRenderer->isTextureRectRotated(), rect.size);    }}
开发者ID:fordream,项目名称:quick,代码行数:26,


示例7: CCSize

CAView* HeroViewController::loadTabBarView(){	CAVector<CATabBarItem*> items;	if (m_pTabBar == NULL){		CATabBarItem* tabBarItem = CATabBarItem::create(UTF8("胜率"), NULL, NULL);		CATabBarItem* tabBarItem1 = CATabBarItem::create(UTF8("使用最多"), NULL, NULL);		items.pushBack(tabBarItem);		items.pushBack(tabBarItem1);	}	m_pTabBar = CATabBar::create(items, CCSize(640, 30));	m_pTabBar->setTitleColorForNormal(CAColor_gray);	m_pTabBar->setTitleColorForSelected(CAColor_white);	m_pTabBar->setSelectedAtIndex(0);	m_pTabBar->setBackGroundColor(CAColor_black);	m_pTabBar->setSelectedBackGroundColor(CAColor_black);	m_pTabBar->setSelectedIndicatorImage(CAImage::create("image/Indicator.png"));	m_pTabBar->showSelectedIndicator();	m_pTabBar->setDelegate(this);	m_pTabBar->setCenterOrigin(CCPoint(320, _size.height / 4 - _px(15)));	this->getView()->insertSubview(m_pTabBar, 2);	return m_pTabBar;}
开发者ID:a752602882,项目名称:DotaMax,代码行数:25,


示例8: initWithPlaceHolder

TextBox::TextBox(string placeHolderText, float size, string fontName, float width, float height, CCTextAlignment textAlignment, char delimiterChar, int maxNumberOfChars, ccColor3B textColor, ccColor3B placeHolderColor){	// It is not editable	_is_active = false;	// Delimiter character	_delimiter_char = delimiterChar;	// Init and add place holder text	initWithPlaceHolder(placeHolderText.c_str(), CCSize(width, height), textAlignment, fontName.c_str(), size);	// Set empty string, so that place holder is not the string	setString("");        // Set color    setColor(textColor);        // Set place holder color    setColorSpaceHolder(placeHolderColor);		// Default value;	_pholder_original_color = m_ColorSpaceHolder;        // Maximum number of characters    _max_chars = maxNumberOfChars;}
开发者ID:Cnotinfor,项目名称:TopQX_2D,代码行数:26,


示例9: CCSize

void HelloWorld::initmapdata(){    CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();    CCSize mapsize = m_mapSprite->getContentSize();    //计算场景的边界    m_border = (visibleSize.height - mapsize.height) / UnitY;    m_border = (int)m_border /2 * UnitY;        //设定当前的地图宽高    m_Mapsize = CCSize(19, 6);    //屏幕绘制为逻辑地图的第几列开始    m_CurrentMapStartPos = CCPoint(0,0);    //当前自己再地图中的位置    m_CurrentPos = CCPoint(0,0);    //根据当前的地图算绘制。。19    //根据当前的位置计算绘制坐标    //逻辑地图的位置继续按屏幕坐标    CCPoint pos;    pos.x = m_CurrentMapStartPos.x * 64;    pos.y = m_CurrentMapStartPos.y * 64+m_border;    m_mapSprite->setPosition(pos);    //设置当前的位置    m_pSprite->setAnchorPoint(ccp(0,0));    SetPlayerPos(m_CurrentPos.x, m_CurrentPos.y);}
开发者ID:mikesimb,项目名称:Classes,代码行数:25,


示例10: switch

void LuaHostWin32::onViewChangeFrameSize(int index){    int w, h;    switch (index)    {        case ID_VIEW_640_960:            w = 640; h = 960;            break;        case ID_VIEW_640_1136:            w = 640; h = 1136;            break;        case ID_VIEW_768_1024:            w = 768; h = 1024;            break;        case ID_VIEW_1536_2048:            w = 1536; h = 2048;            break;        case ID_VIEW_480_800:            w = 480; h = 800;            break;        case ID_VIEW_480_854:            w = 480; h = 854;            break;        case ID_VIEW_600_1024:            w = 600; h = 1024;            break;        case ID_VIEW_720_1280:            w = 720; h = 1280;            break;        case ID_VIEW_800_1280:            w = 800; h = 1280;            break;        case ID_VIEW_1080_1920:            w = 1080; h = 1920;            break;        case ID_VIEW_320_480:        default:            w = 320; h = 480;    }    if (m_project.isLandscapeFrame())    {        int w2 = w;        w = h;        h = w2;    }    m_project.setFrameSize(CCSize(w, h));    m_project.setFrameScale(1.0f);    relaunch();}
开发者ID:ascetic85,项目名称:LuaHostQt,代码行数:60,


示例11: setCleanFunction

bool TimeExchangeView::init(){    CCLoadSprite::doResourceByCommonIndex(11, true);    setCleanFunction([](){        CCLoadSprite::doResourceByCommonIndex(11, false);    });        auto temCCB = CCBLoadFile("TimeExchangeView", this, this);    setContentSize(temCCB->getContentSize());    auto size = CCDirector::sharedDirector()->getWinSize();    float dh = size.height - 852 - 8;    m_infoList->setContentSize(CCSize(m_infoList->getContentSize().width, m_infoList->getContentSize().height + dh));        m_data = CCArray::create();    m_tabView = CCMultiColTableView::create(this, m_infoList->getContentSize());    m_tabView->setDirection(kCCScrollViewDirectionVertical);    m_tabView->setVerticalFillOrder(kCCTableViewFillTopDown);    m_tabView->setMultiColTableViewDelegate(this);    m_tabView->setTouchPriority(Touch_Popup);    m_infoList->addChild(m_tabView);        string msg = _lang("105082");    m_infoLabel->setString(msg);    m_st = true;    m_maxRwdLv = PortActController::getInstance()->getMaxRwdLv();        generateData(NULL);    onEnterFrame(0);    return true;}
开发者ID:ourgames,项目名称:dc208,代码行数:30,


示例12: ccw_click_selector

void CVipCard::onEnter(){	BaseLayer::onEnter();	//确定	CButton* pConfirm = (CButton*)m_ui->findWidgetById("confirm");	pConfirm->setOnClickListener(this, ccw_click_selector(CVipCard::onConfirm));	CButton* cancel = (CButton*)m_ui->findWidgetById("cancel");	cancel->setOnClickListener(this, ccw_click_selector(CVipCard::onCancel));	CButton* pClose = CButton::create("common/back.png", "common/back.png");	pClose->getSelectedImage()->setScale(1.1f);	pClose->setPosition(VLEFT+50, VTOP-50);	pClose->setOnClickListener(this,ccw_click_selector(CVipCard::onClose));	this->addChild(pClose, 999);		CImageViewScale9* pRect1 = (CImageViewScale9*)m_ui->findWidgetById("rect1");	m_cardText = CursorTextField::textFieldWithPlaceHolder("", FONT_NAME, 29, CCSize(690, 110), ccBLACK);	m_cardText->setPriority(this->getTouchPriority());	m_cardText->setLimitNum(17);	m_cardText->setAnchorPoint(ccp(0, 0.5f));	m_cardText->setPosition( ccp(pRect1->getPositionX()-440, pRect1->getPositionY()));	m_ui->addChild(m_cardText, 999);	//展示区图片	CLayout *pShowInfo = CLayout::create();	CScrollView *pScroll = (CScrollView*)m_ui->findWidgetById("scroll_info");	pScroll->setDirection(eScrollViewDirectionVertical);	pScroll->setBounceable(false);	pScroll->getContainer()->addChild(pShowInfo);	CCSize size = CCSize(957, 471);	pShowInfo->setContentSize(size);	pScroll->setContainerSize(size);	pShowInfo->setPosition(ccp(pScroll->getContainerSize().width*0.5f, pScroll->getContainerSize().height*0.5f));	pScroll->setContentOffsetToTop();	//嫁接内容	CLayout* pLayout = (CLayout*)findWidgetById("layer_info");	pLayout->retain();	pLayout->removeFromParent();	pShowInfo->addChild(pLayout);	pLayout->release();	pLayout->setPosition(ccp(size.width/2, size.height/2+10));}
开发者ID:54993306,项目名称:Classes,代码行数:47,


示例13: CCSize

bool PropertyInput::init(){	this->text = CCTextFieldTTF::textFieldWithPlaceHolder("", CCSize(0, 0), kCCTextAlignmentLeft, "Thonburi", 20);	this->text->setAnchorPoint(cocos2d::CCPointZero);	this->addChild(this->text);	return true;}
开发者ID:Whislly,项目名称:DreamBookToolbox,代码行数:8,


示例14: setTitle

bool CTableViewBasicTest::init(){	CTableViewTestSceneBase::init();	setTitle("CTableViewBasicTest");	setDescription("TableView basic test");	CTableView* pTable = CTableView::create(		CCSize(74.0f * 5, 70.0f),		CCSize(74.0f, 70.0f),		50, this, 		ccw_datasource_adapter_selector(CTableViewBasicTest::tableviewDataSource));	pTable->setPosition(CCPoint(480, 320));	m_pWindow->addChild(pTable);	pTable->reloadData();	return true;}
开发者ID:cl0uddajka,项目名称:cocoswidget,代码行数:17,


示例15: MAX

void CAProgress::setContentSize(const CCSize & var){    CAView::setContentSize(CCSize(var.width, MAX(var.height, _px(6))));        m_pTarckImageView->setFrame(this->getBounds());    CCRect rect = CCRect(0, 0, m_pIndicator->getFrameOrigin().x, this->getBounds().size.height);    m_pProgressImageView->setFrame(rect);}
开发者ID:garyyyy,项目名称:CrossApp,代码行数:8,


示例16: setTextures

void UIZoomButton::setTextures(const char* backgroundNormal,const char* backgroundPressed,const char* backgroundDisabled){    m_pNormalBackGround->initWithFile(backgroundNormal);    m_pPressedBackGround->initWithFile(backgroundPressed);    m_pDisabledBackGround->initWithFile(backgroundDisabled);        m_pNormalBackGround->setColor(getColor());    m_pNormalBackGround->setOpacity(getOpacity());    m_pPressedBackGround->setColor(getColor());    m_pPressedBackGround->setOpacity(getOpacity());    m_pDisabledBackGround->setColor(getColor());    m_pDisabledBackGround->setOpacity(getOpacity());        m_pNormalBackGround->setContentSize(CCSize(m_pNormalTitle->boundingBox().size.width+8*2,m_pNormalTitle->boundingBox().size.height+2*2));    m_pPressedBackGround->setContentSize(CCSize(m_pPressedTitle->boundingBox().size.width+8*2,m_pPressedTitle->boundingBox().size.height+2*2));    m_pDisabledBackGround->setContentSize(CCSize(m_pDisabledTitle->boundingBox().size.width+8*2,m_pDisabledTitle->boundingBox().size.height+2*2));}
开发者ID:chenxu111,项目名称:Cocos2d-x-For-CocoStudio,代码行数:17,


示例17: loadIcon

void ZhuantiInfo::loadIcon(){	int startX = 200;	int colNum = 1;	int w = 200;	int h = 300;	int num = vecIconInfo.size();	tileLayer = MyScrollview::create();	tileLayer->setTouchType(MyScrollview::LEFT_RIGHT);	tileLayer->setAnchorPoint(ccp(0,0));	tileLayer->setShowRect(startX,0,Globe::SW-startX,Globe::SH);	tileLayer->setEveroneSize(CCSize(w,h));	tileLayer->setWH(num*w,h);		for(int i = 0;i<num;i++){		string id = Globe::replaceStr(vecIconInfo[i].appid);		MySprite *icon = MySprite::create("screens/public/laoding.png");		if(i==num/2){			icon->setDefaultFocus(true,this);		}						icon->setAddMode(2);		icon->setOpacity(0);		float x = w/2+i*w;		icon->setPosition(ccp(x,240));		icon->setAppId(id);		icon->setName(vecIconInfo[i].name);		icon->setSelectScale(1.1);		icon->setFather(tileLayer);		int faW = 180;		int faH = 265;		float scanX = faW/icon->getContentSize().width;		float scanY = faH/icon->getContentSize().height;		icon->setScaleX(scanX);		icon->setScaleY(scanY);		icon->setFactRect(CCRectMake(icon->getPositionX()-faW/2,		icon->getPositionY()-faH/2,faW,faH));		icon->getImageFromUrl(vecIconInfo[i].url,Globe::zhuantiDetailSavaPaht+"/"+id);		vecDownLoadSprite.push_back(icon);		addMySprite(icon);		tileLayer->addChild(icon);		vectiles.push_back(icon);	}				int offsetX = Globe::SW/2-(vectiles[0]->rect.origin.x+vectiles[0]->rect.size.width/2+(num-1)*w/2);	if(tileLayerX!=0){		tileLayer->setPosition(ccp(tileLayerX,0));	}else{		tileLayer->setPosition(ccp(offsetX,0));	}	if(index>num-1){//回到上次的焦点		index = num-1;	}	if(index>0){//回到上次的焦点		changeFocus(vectiles[index]);	}				this->addChild(tileLayer,10);}
开发者ID:yirenzhi,项目名称:jake,代码行数:58,


示例18: setCleanFunction

bool YuanJunDetailView::init(){    if (!PopupBaseView::init()) {        return false;    }	CCLoadSprite::doResourceByCommonIndex(204, true);    CCLoadSprite::doResourceByCommonIndex(8, true);    CCLoadSprite::doResourceByCommonIndex(7, true);    setCleanFunction([](){        CCLoadSprite::doResourceByCommonIndex(7, false);        CCLoadSprite::doResourceByCommonIndex(8, false);        CCLoadSprite::doResourceByCommonIndex(204, false);    });	    setIsHDPanel(true);    auto tmpCCB = CCBLoadFile("YuanJunDetailView",this,this);    this->setContentSize(tmpCCB->getContentSize());        if (!CCCommonUtils::isIosAndroidPad()) {        int preH = m_viewBg->getContentSize().height;        changeBGHeight(m_viewBg);        int newH = m_viewBg->getContentSize().height;        int addH = newH- preH;        m_infoList->setContentSize(CCSize(m_infoList->getContentSize().width,m_infoList->getContentSize().height+addH));        m_infoList->setPositionY(m_infoList->getPositionY()-addH);        m_bottomNode->setPositionY(m_bottomNode->getPositionY()-addH);    }        m_data = CCArray::create();        m_tabView = CCTableView::create(this, m_infoList->getContentSize());    m_tabView->setDirection(kCCScrollViewDirectionVertical);    m_tabView->setVerticalFillOrder(kCCTableViewFillTopDown);    m_tabView->setTouchPriority(Touch_Default);    m_infoList->addChild(m_tabView);        int buildId = FunBuildController::getInstance()->getMaxLvBuildByType(FUN_BUILD_STABLE);    if (buildId>0) {        FunBuildInfo& info = FunBuildController::getInstance()->getFunbuildById(buildId);        if(&info!=NULL){            m_maxSoldier = atoi(info.para[3].c_str())+CCCommonUtils::getEffectValueByNum(141);                    }    }    std::string numStr = "0/";    numStr.append(CC_ITOA(m_maxSoldier));    m_numTxt->setString(numStr);    m_tip->setString(_lang("115173"));    CCCommonUtils::setButtonTitle(m_btnResult, _lang("115563").c_str());    AllianceRallyListCommand* cmd = new AllianceRallyListCommand();    cmd->setCallback(CCCallFuncO::create(this, callfuncO_selector(YuanJunDetailView::getServerData), NULL));    cmd->sendAndRelease();        return true;}
开发者ID:ourgames,项目名称:dc208,代码行数:57,


示例19: addContent

void PopChoiceDlg::addContent(){	m_content = LabelTTF::create("Hello! Welcome to our game!", "fonts/DTLNobelT-Bold.otf", 24);	m_content->setColor(Color3B(0, 0, 0));	m_content->setPosition(ccp(m_size.width / 2, m_size.height * 0.33));	m_content->setDimensions(CCSize(this->m_size.width - 60, this->m_size.height - 100));	m_content->setHorizontalAlignment(kCCTextAlignmentLeft);	m_bgSprite->addChild(m_content);}
开发者ID:zoominhao,项目名称:CountMoney,代码行数:9,


示例20: FKCW_UIWidget_ExpandableNode

//-------------------------------------------------------------------------FKCW_UIWidget_ExpandableNode* FKCW_UIWidget_ExpandableNode::create(){	FKCW_UIWidget_ExpandableNode* pRet = new FKCW_UIWidget_ExpandableNode();	pRet->init();	pRet->setContentSize(CCSize(100, 100));	pRet->setAnchorPoint(CCPoint(0.5f, 0.5f));	pRet->autorelease();	return pRet;}
开发者ID:duzhi5368,项目名称:FKCocos2dxWrapper_2.x,代码行数:10,


示例21: CCBLoadFile

bool AllianceIntroTip::init(){    auto ccbNode = CCBLoadFile("AllianceIntroTip", this, this);    this->setContentSize(ccbNode->getContentSize());    m_tip->setString(m_tipStr);    int textH = m_tip->getContentSize().height*m_tip->getOriginScaleY() +40;    if(m_up){        m_arrow->setRotation(90);    }else{        m_arrow->setRotation(-90);    }    m_arrow->setPosition(m_pos);        if(m_icon!="" && m_iconNode){        m_tip->setDimensions(CCSize(380, 0));        textH = MAX(textH,200);        auto spr = CCLoadSprite::createSprite(m_icon.c_str());        spr->setPositionY(textH/2);        m_iconNode->addChild(spr);        CCCommonUtils::setSpriteMaxSize(spr, 120);        m_bg->setInsetBottom(30);        m_bg->setInsetTop(30);        m_bg->setInsetLeft(30);        m_bg->setInsetRight(30);        m_bg->setContentSize(CCSize(520,textH));        m_tip->setPosition(ccp(120 + 380/2, textH/2));        m_tip->setHorizontalAlignment(kCCTextAlignmentLeft);    }else if(textH>m_bg->getContentSize().height){        m_bg->setInsetBottom(30);        m_bg->setInsetTop(30);        m_bg->setInsetLeft(30);        m_bg->setInsetRight(30);        m_bg->setContentSize(CCSize(m_bg->getContentSize().width,textH));        m_tip->setPositionY(textH/2);        if(m_up){            m_arrow->setPosition(ccp(m_pos.x, textH + 10));        }else{            m_arrow->setPosition(ccp(m_pos.x, m_arrow->getPositionY()));        }            }        m_isAutoAjust=false;    return true;}
开发者ID:ourgames,项目名称:dc208,代码行数:44,


示例22: switch

void AllianceIntroTip::autoAjustLayout(){    CCSize size = m_bg->getContentSize();    CCSize arrowSize = m_arrow->getContentSize();    switch (m_direction) {        case AllianceIntroTip_Bottom:{            m_arrow->setRotation(180);            m_arrow->setScaleX(-1);            m_arrow->setScaleY(1);            m_bg->setPosition(ccp(0, -(arrowSize.height * 0.35 + size.height*0.5 - 5)));            m_tip->setPosition(m_bg->getPosition());            setContentSize(CCSize(size.width, size.height + arrowSize.height));            break;        }        case AllianceIntroTip_Right:{            m_arrow->setRotation(-90);            m_arrow->setScaleX(1);            m_arrow->setScaleY(-1);            m_bg->setPosition(ccp(arrowSize.width*0.3 + size.width * 0.5 - 5, 0));            m_tip->setPosition(m_bg->getPosition());            setContentSize(CCSize(arrowSize.width + size.width, size.height));            break;        }        case AllianceIntroTip_Left:{            m_arrow->setRotation(90);            m_arrow->setScaleX(-1);            m_arrow->setScaleY(1);            m_bg->setPosition(ccp(-(arrowSize.width*0.5 + + size.width * 0.5 - 5), 0));            m_tip->setPosition(m_bg->getPosition());            setContentSize(CCSize(arrowSize.width + size.width, size.height));            break;        }        case AllianceIntroTip_Top:        default:{            m_arrow->setRotation(0);            m_arrow->setScaleX(1);            m_arrow->setScaleY(1);            m_bg->setPosition(ccp(0, arrowSize.height * 0.35 + size.height*0.5 - 5));            m_tip->setPosition(m_bg->getPosition());            setContentSize(CCSize(size.width, size.height + arrowSize.height));            break;        }    }    refreshTouchNode();}
开发者ID:ourgames,项目名称:dc208,代码行数:44,


示例23: removeAllChildren

void ItemCell::f_init(float w, float h, int type, ItemCellData* a_icd){	removeAllChildren();	sum = a_icd->sum;	lock = a_icd->lock;	initwithPre("Images/button",w,h);	string name = a_icd->name;	CCLOG("Ready for item:%d,%s",a_icd->type_id,name.c_str());	m_iType = type;	CCSprite* t_cs = CCSprite::create(CCString::createWithFormat("Images/icon_%s.png",a_icd->icon_mask.c_str())->getCString());	t_cs->setAnchorPoint(ccp(0,0));	t_cs->setPosition(ccp(1,1));	addChild(t_cs);	CCLabelTTF* t_ct = CCLabelTTF::create(name.c_str(), FNT_UI_LABEL, 20,CCSize(w,0), kCCTextAlignmentLeft);	t_ct->setAnchorPoint(ccp(0,0));	t_ct->setPosition(ccp(31,1));	t_ct->setColor(COLOUR_NORMAL);	addChild(t_ct);	switch(type)	{	case(0):		{			labelAtlas = CCLabelBMFont::create(CCString::createWithFormat("%d",a_icd->sum)->getCString(), FNT_CHN);			labelAtlas->setAnchorPoint(ccp(0,0));			labelAtlas->setPosition(ccp(w-50,1));			labelAtlas->setColor(COLOUR_NORMAL);			addChild(labelAtlas);			break;		}	case(1):		{			setstringnull();			break;		}	case(2):		{			labelAtlas = CCLabelBMFont::create(CCString::createWithFormat("%d/%d",a_icd->lock,a_icd->sum)->getCString(), FNT_CHN);			labelAtlas->setAnchorPoint(ccp(0,0));			labelAtlas->setPosition(ccp(w-50,1));			labelAtlas->setColor(COLOUR_NORMAL);			addChild(labelAtlas);				if(a_icd->sum == a_icd->lock)			//All Equip is Equipped.			{				t_ct->setColor(ccGRAY);				labelAtlas->setColor(ccGRAY);			}			break;		}	}	//settouchstate(false);}
开发者ID:steinkrausls,项目名称:cocotd,代码行数:56,


示例24: CCSize

LayerChanToast::LayerChanToast(string message){	vector<string> lstRegex;	for( int i = 1; i <= 16; i++ ){		lstRegex.push_back( CCString::createWithFormat("(%d)", i)->getCString() );	}	this->setAnchorPoint(ccp(0, 0));	// text	cocos2d::ui::RichText* label = cocos2d::ui::RichText::create();	label->setAnchorPoint(ccp(0, 0));	label->setPosition(ccp(0, HEIGHT_DESIGN / 3.5));	vector<string> lstContents = mUtils::splitStringByListRegex(message, lstRegex);	int wLabel = 0, hLabel = 0;	for( int i = 0; i < lstContents.size(); i++ ){		bool check = false;		int j = 0;		for( j = 0; j < lstRegex.size(); j++ )			if( lstRegex.at(j) == lstContents.at(i) ){				check = true;				break;			}			if( check ){				CCArmature *armature = CCArmature::create(CCString::createWithFormat("onion%d", 1)->getCString());				armature->getAnimation()->playByIndex(j);				cocos2d::ui::RichElementCustomNode* recustom = cocos2d::ui::RichElementCustomNode::create(1, ccWHITE, 255, armature);				label->pushBackElement(recustom);				wLabel += 50;				hLabel = 55;			}else{				CCLabelTTF *l = CCLabelTTF::create(lstContents.at(i).c_str(), "Arial", 16);				l->setColor(ccc3(204, 16, 85));				cocos2d::ui::RichElementText* re1 = cocos2d::ui::RichElementText::create(1, ccWHITE, 255, lstContents.at(i).c_str(), "Arial", 16);				label->pushBackElement(re1);				wLabel += l->getContentSize().width;				hLabel = hLabel > 50 ? 55 : l->getContentSize().height;			}	}	this->addChild(label, 1, 0);	CCSize sizeDesign = CCSize(169, 30);	CCSpriteBatchNode *batchNode = CCSpriteBatchNode::create("chats/framechat_a.png");	CCScale9Sprite *blocks = CCScale9Sprite::create();	blocks ->updateWithBatchNode(batchNode , CCRect(0, 0, sizeDesign.width, sizeDesign.height), false, CCRect(10, 10, sizeDesign.width - 20, sizeDesign.height - 20));	CCSize size = CCSizeMake(wLabel + 10, hLabel + 5);	blocks ->setContentSize(size);	blocks->setAnchorPoint(ccp(0.5, 0.5));	blocks->setPosition(ccp(label->getPositionX() + wLabel / 2, label->getPositionY() + hLabel / 2));	blocks->setColor(ccc3(84, 81, 69));	blocks->setOpacity(200);	this->setPosition(ccp((WIDTH_DESIGN - size.width) / 2, 100));	// add	this->addChild(blocks);}
开发者ID:mrktj,项目名称:iCasino_v2,代码行数:56,


示例25: setBarLength

void UISlider::setBarLength(float length){    if (!m_bBarScale9Enable)    {        return;    }    m_fBarLength = length;    dynamic_cast<CCScale9Sprite*>(m_pBarNode)->setContentSize(CCSize(length, m_pBarNode->getContentSize().height));    setSlidBallPercent(m_nBarPercent);}
开发者ID:chenxu111,项目名称:Cocos2d-x-For-CocoStudio,代码行数:10,


示例26: m_nColumns

Deck::Deck(int nCol, int nRow)    : m_nColumns(nCol),      m_nRows(nRow),      m_direction(ccp(0, 1)),      m_position(ccp(0, 0)),      m_size(CCSize(0, 0)) {    Log::d(TAG, "Deck()");    m_pNode = initNode();    //m_pNode->ignoreAnchorPointForPosition(false);}
开发者ID:pharspher,项目名称:Cocos2dxTest,代码行数:10,


示例27: CCBLoadFile

bool HowToPlayCell::init(int idx,CCDictionary* _htpGroup){    bool ret = true;    CCBLoadFile("TIPS_how_to_play_cell",this,this);    m_contextText->setDimensions(CCSize(460,0));    this->setContentSize(CCSizeMake(640, 130));    m_htpGroup = _htpGroup;    setData(idx);    return ret;}
开发者ID:ourgames,项目名称:dc208,代码行数:10,


示例28: if

void CANavigationBar::showTitle(){    CCRect rect;    rect.origin = this->getBounds().size/2;    rect.size.height = this->getBounds().size.height;    rect.size.width = this->getBounds().size.width - rect.size.height * 4;        if (m_pTitle)    {        this->removeSubview(m_pTitle);        m_pTitle = NULL;    }        if (CAView* titleView = m_pItem->getTitleView())    {        float aspectRatio = 0;        if (!titleView->getFrame().size.equals(CCSizeZero))        {            aspectRatio = titleView->getFrame().size.width / titleView->getFrame().size.height;        }                rect.size.height *= 2/3.0f;        rect.size.width = aspectRatio < FLT_EPSILON ? rect.size.width : aspectRatio * rect.size.height;        titleView->setCenter(rect);        this->addSubview(titleView);        m_pTitle = titleView;    }    else if (CAImage* image = m_pItem->getTitleViewImage())    {        float height = MIN(image->getContentSize().height, rect.size.height * 0.75f);        float width =  height * image->getContentSize().width / image->getContentSize().height;        width = MIN(rect.size.width, width);        rect.size = CCSize(width, height);        m_pTitle = CAImageView::createWithImage(image);        m_pTitle->setCenter(rect);        this->addSubview(m_pTitle);    }    else    {        CALabel* title = CALabel::createWithCenter(rect);        title->setTextAlignment(CATextAlignmentCenter);        title->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);        title->setNumberOfLine(1);        title->setColor(m_cTitleColor);        title->setFontSize(_px(32));        this->addSubview(title);        m_pTitle = title;                if (m_pItem)        {            std::string str = m_pItem->getTitle();            ((CALabel*)m_pTitle)->setText(str.c_str());        }    }}
开发者ID:nightdomain,项目名称:CrossApp,代码行数:55,


示例29: CCSize

bool AppDelegate::applicationDidFinishLaunching(){    // initialize director    CCDirector* pDirector = CCDirector::sharedDirector();    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();        pDirector->setOpenGLView(pEGLView);        CCSize screenSize = pEGLView->getFrameSize();    CCSize designSize = CCSize(2048, 1536);        CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionExactFit);	std::vector<std::string> searchPaths;    if (screenSize.height > 768) {		searchPaths.push_back("ipadhd");		CCFileUtils::sharedFileUtils()->setSearchPaths(searchPaths);        pDirector->setContentScaleFactor(1536/designSize.height);    } else if (screenSize.height > 320) {		searchPaths.push_back("ipad");		CCFileUtils::sharedFileUtils()->setSearchPaths(searchPaths);        pDirector->setContentScaleFactor(768/designSize.height);    } else {		searchPaths.push_back("iphone");		CCFileUtils::sharedFileUtils()->setSearchPaths(searchPaths);        pDirector->setContentScaleFactor(380/designSize.height);    }    	SimpleAudioEngine::sharedEngine()->preloadBackgroundMusic(CCFileUtils::sharedFileUtils()->fullPathForFilename("background.mp3").c_str());	SimpleAudioEngine::sharedEngine()->preloadEffect(CCFileUtils::sharedFileUtils()->fullPathForFilename("falling.wav").c_str());	SimpleAudioEngine::sharedEngine()->preloadEffect(CCFileUtils::sharedFileUtils()->fullPathForFilename("hitBuilding.wav").c_str());	SimpleAudioEngine::sharedEngine()->preloadEffect(CCFileUtils::sharedFileUtils()->fullPathForFilename("jump.wav").c_str());	SimpleAudioEngine::sharedEngine()->preloadEffect(CCFileUtils::sharedFileUtils()->fullPathForFilename("crashing.wav").c_str());	SimpleAudioEngine::sharedEngine()->preloadEffect(CCFileUtils::sharedFileUtils()->fullPathForFilename("start.wav").c_str());	SimpleAudioEngine::sharedEngine()->preloadEffect(CCFileUtils::sharedFileUtils()->fullPathForFilename("openUmbrella.wav").c_str());        SimpleAudioEngine::sharedEngine()->setBackgroundMusicVolume(0.5f);    SimpleAudioEngine::sharedEngine()->setEffectsVolume(0.5f);            // turn on display FPS    pDirector->setDisplayStats(false);    // set FPS. the default value is 1.0/60 if you don't call this    pDirector->setAnimationInterval(1.0 / 60);    // create a scene. it's an autorelease object    CCScene *pScene = GameLayer::scene();    // run    pDirector->runWithScene(pScene);    return true;}
开发者ID:pdpdds,项目名称:cocos2dx-dev,代码行数:54,



注:本文中的CCSize函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ CCSizeMake函数代码示例
C++ CCRectMake函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。