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


C++ CCPoint函数代码示例

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


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

示例1: initRenderer

void Slider::initRenderer()
{
    _barRenderer = CCSprite::create();
    _progressBarRenderer = CCSprite::create();
    _progressBarRenderer->setAnchorPoint(CCPoint(0.0f, 0.5f));
    CCNodeRGBA::addChild(_barRenderer, BASEBAR_RENDERER_Z, -1);
    CCNodeRGBA::addChild(_progressBarRenderer, PROGRESSBAR_RENDERER_Z, -1);
    _slidBallNormalRenderer = CCSprite::create();
    _slidBallPressedRenderer = CCSprite::create();
    _slidBallPressedRenderer->setVisible(false);
    _slidBallDisabledRenderer = CCSprite::create();
    _slidBallDisabledRenderer->setVisible(false);
    _slidBallRenderer = CCNode::create();
    _slidBallRenderer->addChild(_slidBallNormalRenderer);
    _slidBallRenderer->addChild(_slidBallPressedRenderer);
    _slidBallRenderer->addChild(_slidBallDisabledRenderer);
    CCNodeRGBA::addChild(_slidBallRenderer, SLIDBALL_RENDERER_Z, -1);
}
开发者ID:2193q,项目名称:cocos2d-x,代码行数:18,代码来源:UISlider.cpp

示例2: setTitle

bool CButtonEventTest::init()
{
	CButtonTestSceneBase::init();
	setTitle("CButtonEventTest");
	setDescription("button events");

	CButton* pButton1 = CButton::create("btn1_1.png", "btn1_2.png", "btn1_3.png");
	pButton1->setOnTouchBeganListener(this, ccw_touchbegan_selector(CButtonEventTest::onTouchBegan));
	pButton1->setOnTouchMovedListener(this, ccw_touchevent_selector(CButtonEventTest::onTouchMoved));
	pButton1->setOnTouchEndedListener(this, ccw_touchevent_selector(CButtonEventTest::onTouchEnded));
	pButton1->setOnTouchCancelledListener(this, ccw_touchevent_selector(CButtonEventTest::onTouchCancelled));
	pButton1->setPosition(CCPoint(350, 320));
	m_pWindow->addChild(pButton1);

	m_pText1 = CLabel::create();
	m_pText1->setAnchorPoint(CCPoint(0, 0.5));
	m_pText1->setPosition(CCPoint(260, 430));
	m_pText1->setFontSize(35.0f);
	m_pText1->setString("none");
	m_pWindow->addChild(m_pText1);

	m_pDurationText = CLabel::create();
	m_pDurationText->setPosition(CCPoint(260, 390));
	m_pDurationText->setFontSize(35.0f);
	m_pDurationText->setString("ms:0");
	m_pDurationText->setAnchorPoint(CCPoint(0, 0.5));
	m_pWindow->addChild(m_pDurationText);

	CButton* pButton2 = CButton::create("btn1_1.png", "btn1_2.png", "btn1_3.png");
	pButton2->setOnClickListener(this, ccw_click_selector(CButtonEventTest::onClick));
	pButton2->setPosition(CCPoint(610, 320));
	m_pWindow->addChild(pButton2);

	m_pText2 = CLabel::create();
	m_pText2->setAnchorPoint(CCPoint(0, 0.5));
	m_pText2->setPosition(CCPoint(520, 430));
	m_pText2->setFontSize(35.0f);
	m_pText2->setString("none");
	m_pWindow->addChild(m_pText2);

	return true;
}
开发者ID:Coolxiaoo,项目名称:CocosWidget,代码行数:42,代码来源:ButtonTest.cpp

示例3: ccpSub

CAImage* CAProgress::getImage(CAImage* image)
{
    CCRect rect;
    rect.origin = ccpSub(ccpMult(image->getContentSize(), 0.5f), CCPoint(0.5f, 0.5f));
    rect.size = CCSize(1, 1);
    
	CAScale9ImageView *scale9Image = CAScale9ImageView::createWithImage(rect, image);
    scale9Image->setAnchorPoint(CCPointZero);
	scale9Image->setPreferredSize(this->getBounds().size);
    this->addSubview(scale9Image);
    
	CCRenderTexture* render = CCRenderTexture::create(this->getBounds().size.width, this->getBounds().size.height, kCAImagePixelFormat_RGBA8888);
	render->beginWithClear(0, 0, 0, 0);
    scale9Image->visit();
	render->end();
    scale9Image->removeFromSuperview();
	return render->getSprite()->getImage();
}
开发者ID:tangyijie,项目名称:CrossApp,代码行数:18,代码来源:CAProgress.cpp

示例4: setContentSize

void CCheckBox::setNormalSpriteFrame(CCSpriteFrame* pFrame)
{
	if( pFrame )
	{
		if( m_pNormal )
		{
			m_pNormal->setDisplayFrame(pFrame);
			setContentSize(m_pNormal->getContentSize());
		}
		else
		{
			m_pNormal = CCSprite::createWithSpriteFrame(pFrame);
			setContentSize(m_pNormal->getContentSize());
			addChild(m_pNormal);
		}
		m_pNormal->setPosition(CCPoint(m_obContentSize.width/2, m_obContentSize.height/2));
	}
}
开发者ID:54993306,项目名称:Classes,代码行数:18,代码来源:CheckBox.cpp

示例5: CC_SAFE_RETAIN

bool Widget::init()
{
    if (CCNode::init())
    {
        _widgetChildren = CCArray::create();
        CC_SAFE_RETAIN(_widgetChildren);
        _layoutParameterDictionary = CCDictionary::create();
        CC_SAFE_RETAIN(_layoutParameterDictionary);
        _nodes = CCArray::create();
        CC_SAFE_RETAIN(_nodes);
        initRenderer();
        setBright(true);
        ignoreContentAdaptWithSize(true);
        setAnchorPoint(CCPoint(0.5f, 0.5f));
        return true;
    }
    return false;
}
开发者ID:fordream,项目名称:quick,代码行数:18,代码来源:UIWidget.cpp

示例6: addChild

void CCheckBox::setNormalPressTexture(CCTexture2D* pTexture)
{
	if( m_pNormalPress )
	{
		m_pNormalPress->setTexture(pTexture);

		CCRect tRect = CCRectZero;
		tRect.size = pTexture->getContentSize();
		m_pNormalPress->setTextureRect(tRect);
	}
	else
	{
		m_pNormalPress = CCSprite::createWithTexture(pTexture);
		addChild(m_pNormalPress);
	}
	m_pNormalPress->setVisible(false);
	m_pNormalPress->setPosition(CCPoint(m_obContentSize.width/2, m_obContentSize.height/2));
}
开发者ID:54993306,项目名称:Classes,代码行数:18,代码来源:CheckBox.cpp

示例7: CCPoint

void CANavigationController::pushViewController(CAViewController* viewController, bool animated)
{
    if (this->getView()->getSuperview() == NULL)
    {
        return;
    }

    if (m_pContainer->getActionByTag(0))
    {
        return;
    }

    float x = m_pContainer->getFrame().size.width;
    
    CAViewController* lastViewController = m_pViewControllers.back();
    lastViewController->getView()->setFrame(CCRect(-x, 0, 0, 0));
    viewController->retain();
    viewController->m_pNavigationController = this;
    m_pViewControllers.push_back(viewController);
    if (viewController->getNavigationBarItem() == NULL && viewController->getTitle().compare("") != 0)
    {
        viewController->setNavigationBarItem(CANavigationBarItem::create(viewController->getTitle()));
    }
    m_pNavigationBar->pushItem(viewController->getNavigationBarItem());
    viewController->addViewFromSuperview(m_pContainer);
    
    if (animated)
    {
        m_pContainer->stopAllActions();
        m_pContainer->setFrame(CCRect(x, m_pContainer->getFrame().origin.y, 0, 0));
        
        CCDelayTime* delayTime = CCDelayTime::create(0.1f);
        CCMoveBy* moveBy = CCMoveBy::create(0.3f, CCPoint(-x, 0));
        CCEaseSineOut* easeBack = CCEaseSineOut::create(moveBy);
        CCCallFunc* finish = CCCallFunc::create(this, callfunc_selector(CANavigationController::pushViewControllerFinish));
        CCSequence* actions = CCSequence::create(delayTime, easeBack, finish, NULL);
        m_pContainer->runAction(actions);
        actions->setTag(0);
    }
    else
    {
        this->pushViewControllerFinish();
    }
}
开发者ID:jonesgithub,项目名称:CrossApp,代码行数:44,代码来源:CAViewController.cpp

示例8: ccpSub

CAImage* CAProgress::getImage(CAImage* image)
{
	CCScale9Sprite *scale9Image = CCScale9Sprite::createWithImage(image);
    CCRect rect;
    rect.origin = scale9Image->getFrame().size/2;
    rect.origin = ccpSub(rect.origin, CCPoint(0.5f, 0.5f));
    rect.size = CCSize(1, 1);
    scale9Image->setCapInsets(rect);
	scale9Image->setPreferredSize(this->getBounds().size);
    scale9Image->setAnchorPoint(CCPointZero);
    this->addSubview(scale9Image);
    
	CCRenderTexture* render = CCRenderTexture::create(this->getBounds().size.width, this->getBounds().size.height, kCCTexture2DPixelFormat_RGBA8888);
	render->beginWithClear(0, 0, 0, 0);
    scale9Image->visit();
	render->end();
    scale9Image->removeFromSuperview();
	return render->getSprite()->getImage();
}
开发者ID:Jimlan,项目名称:CrossApp,代码行数:19,代码来源:CAProgress.cpp

示例9: ccp

void MyScene::addBackground(){
	CCTMXTiledMap* pTmap = CCTMXTiledMap::create("TileMaps/TestDesert.tmx");
	pTmap->setName("Tmap");
	backgroundNode = CCParallaxNode::create();
	backgroundNode->setName("Background");
	backgroundNode->addChild(pTmap, 1, ccp(1.0f, 1.0f), ccp(0, 0));
	this->addChild(backgroundNode, 0);

	CCTMXObjectGroup* objects = pTmap->objectGroupNamed("Objects");
	ValueMap& spawnPoint = objects->getObject("SpawnPoint");
	CCTMXLayer* metaInfo = pTmap->getLayer("MetaInfo");
	metaInfo->setVisible(false);

	//create a dragon on "SpawnPoint"
	int x = spawnPoint["x"].asInt();
	int y = spawnPoint["y"].asInt();

	this->createDragon(CCPoint(ccp(x, y)));
}
开发者ID:yooasd11,项目名称:summerproject,代码行数:19,代码来源:MyScene.cpp

示例10: menu_selector

void CNetworkPlayerNumberLayer::CreateBackButtonMenu( CCSize visibleSize )
{
	CCMenu *BackButtonTable = CCMenu::createWithItems(NULL, NULL);
    
	CCMenuItemImage* pBackButton = CCMenuItemImage::create(
                                                           SHARED_BTN_BACK.c_str(),
                                                           SHARED_BTN_BACK.c_str(),
                                                           this,
                                                           menu_selector(CNetworkPlayerNumberLayer::MainSceneCallback)
                                                           );
    
	pBackButton->setAnchorPoint( ccp(0, 0) );
	pBackButton->setPosition( CCPoint( WAITING_CHANNEL_BACK_BUTTON_POSITION ) );
    
	BackButtonTable->addChild(pBackButton);
	BackButtonTable->setPosition( ccp(0, 0) );
    
	this->addChild(BackButtonTable);
}
开发者ID:junggang,项目名称:blackbags,代码行数:19,代码来源:NetworkPlayerNumberLayer.cpp

示例11: setFrame

void CATextSelViewEx::showTextSelView(CAView* pControlView, const std::vector<CCRect>& vt, float iLineHeight)
{
    setFrame(this->getSuperview()->getFrame());
	setColor(CAColor_clear);
	showTextViewMark(vt);

	CCRect r = (vt.size() == 1) ? vt[0] : vt.back();

	CCPoint pt1 = vt[0].origin;
	CCPoint pt2 = CCPoint(r.origin.x + r.size.width, r.origin.y + r.size.height);

	m_pCursorMarkL->setFrame(CCRect(pt1.x - CATextSelectArrWidth, pt1.y + iLineHeight, CATextSelectArrWidth, CATextSelectArrHeight));
	m_pCursorMarkL->setVisible(true);

	m_pCursorMarkR->setFrame(CCRect(pt2.x, pt2.y, CATextSelectArrWidth, CATextSelectArrHeight));
	m_pCursorMarkR->setVisible(true);
    this->setVisible(true);
	m_pControlView = pControlView;
}
开发者ID:garyyyy,项目名称:CrossApp,代码行数:19,代码来源:CATextEditHelper.cpp

示例12: CC_BREAK_IF

void CATabBar::setSelectedAtIndex(int index)
{
    do
    {
        CC_BREAK_IF(index < 0);
        CC_BREAK_IF(index >= m_pItems.size());

        if (m_pSelectedItem && m_pSelectedItem->getSelectedImage())
        {
            CAView* viewLast = m_pViews.at(m_nSelectedIndex);
            if (CAImageView* imageView = dynamic_cast<CAImageView*>(viewLast->getSubviewByTag(0xffff)))
            {
                imageView->setImage(m_pSelectedItem->getImage());
            }
        }
        
        m_nSelectedIndex = index;
        m_pSelectedItem = m_pItems.at(m_nSelectedIndex);
        m_pSelectedBackGround->setFrame(m_pViews.at(m_nSelectedIndex)->getFrame());
        
        if (m_pSelectedIndicator)
        {
            ((CCScale9Sprite*)m_pSelectedIndicator)->setPreferredSize(CCSize(m_cItemSize.width, m_cItemSize.height / 10));
            m_pSelectedIndicator->stopAllActions();
            CCPoint p = CCPoint(m_pSelectedBackGround->getFrame().origin.x, m_pSelectedBackGround->getFrame().size.height);
            CCMoveTo* moveTo = CCMoveTo::create(0.3f, p);
            CCEaseSineOut* easeBack = CCEaseSineOut::create(moveTo);
            m_pSelectedIndicator->runAction(easeBack);
        }
        
        if (m_pSelectedItem->getSelectedImage())
        {
            CAView* view = m_pViews.at(m_nSelectedIndex);
            if (CAImageView* imageView = dynamic_cast<CAImageView*>(view->getSubviewByTag(0xffff)))
            {
                imageView->setImage(m_pSelectedItem->getSelectedImage());
            }
        }
        
        m_pDelegate->tabBarSelectedItem(this, m_pSelectedItem, m_nSelectedIndex);
    }
    while (0);
}
开发者ID:Jimlan,项目名称:CrossApp,代码行数:43,代码来源:CABar.cpp

示例13: showSelectedIndicator

void CATabBar::showSelectedIndicator()
{
    if (m_pSelectedIndicator)
    {
        m_pSelectedIndicator->removeFromSuperview();
        m_pSelectedIndicator=NULL;
    }
    
    if (m_pSelectedIndicatorImage == NULL)
    {
        m_pSelectedIndicatorImage = CAImage::create("tabBarController_selected_bottom.png");
    }
    
    m_pSelectedIndicator = CCScale9Sprite::createWithImage(m_pSelectedIndicatorImage);
    ((CCScale9Sprite*)m_pSelectedIndicator)->setPreferredSize(CCSize(m_cItemSize.width, m_cItemSize.height / 10));
    m_pSelectedIndicator->setAnchorPoint(CCPoint(0.0f, 1.0f));
    m_pSelectedIndicator->setFrame(CCRect(0, this->getBounds().size.height, 0, 0));
    this->insertSubview(m_pSelectedIndicator, 2);
}
开发者ID:Jimlan,项目名称:CrossApp,代码行数:19,代码来源:CABar.cpp

示例14: if

bool CATextField::attachWithIME()
{
    bool bRet = CAIMEDelegate::attachWithIME();
    if (bRet)
    {
        // open keyboard
        CCEGLView * pGlView = CAApplication::getApplication()->getOpenGLView();
        if (pGlView)
        {
#if(CC_TARGET_PLATFORM==CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM==CC_PLATFORM_IOS)
            if (getKeyboardType() ==KEY_BOARD_TYPE_NORMAL)
            {
                pGlView->setIMEKeyboardDefault();
            }
            else if (getKeyboardType() ==KEY_BOARD_TYPE_NUMBER)
            {
                pGlView->setIMEKeyboardNumber();
            }
            else if(getKeyboardType() ==KEY_BOARD_TYPE_ALPHABET)
            {
                pGlView->setIMEKeyboardAlphabet();
            }
            
            if (getKeyboardReturnType() ==KEY_BOARD_RETURN_SEND)
            {
                pGlView->setIMEKeyboardReturnSend();
            }
            else if (getKeyboardReturnType() ==KEY_BOARD_RETURN_SEARCH)
            {
                pGlView->setIMEKeyboardReturnSearch();
            }
            else if(getKeyboardReturnType() ==KEY_BOARD_RETURN_DONE)
            {
                pGlView->setIMEKeyboardReturnDone();
            }
#endif
            this->showCursorMark();
            m_pCursorMark->setCenterOrigin(CCPoint(getCursorX() + m_iHoriMargins, m_obContentSize.height / 2));
            pGlView->setIMEKeyboardState(true);
        }
    }
    return bRet;
}
开发者ID:Brian1900,项目名称:CrossApp,代码行数:43,代码来源:CATextField.cpp

示例15: initRole

void GameLayer::extraInit() {
    
    initRole();
    initGround();
    initCollisions();
    
    setRoleState(ROLE_STATE_JUMP_DOWN);
    setTouchEnabled(false);
    
    BBButton *button = BBButton::create(CCSizeMake(200, 60), this, bbButtonFunI_selector(GameLayer::restart), NULL, NULL, NULL, NULL, "Play Again");
    button->mLabel->setFontSize(30);
    button->setPosition(CCPoint(getContentSize().width - button->getContentSize().width, getContentSize().height - button->getContentSize().height));
    button->mDependedTarget = this;
    this->addChild(button, 10);
    
    setScore(0);
    
    beginCountdown(3);
}
开发者ID:DoubleHH,项目名称:FlappyBird,代码行数:19,代码来源:GameLayer.cpp


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