当前位置: 首页>>代码示例>>C++>>正文


C++ CCSize函数代码示例

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


在下文中一共展示了CCSize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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,代码来源:CCSReader.cpp

示例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,代码来源:GameBackground.cpp

示例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,代码来源:UpdateLayer.cpp

示例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,代码来源:ButtonTest.cpp

示例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,代码来源:CABar.cpp

示例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,代码来源:UISlider.cpp

示例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,代码来源:HeroViewController.cpp

示例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,代码来源:TextBox.cpp

示例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,代码来源:HelloWorldScene.cpp

示例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,代码来源:LuaHostWin32.cpp

示例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,代码来源:TimeExchangeView.cpp

示例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,代码来源:CVipCard.cpp

示例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,代码来源:PropertyLayer.cpp

示例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,代码来源:TableViewTest.cpp

示例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,代码来源:CAProgress.cpp


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