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


C++ CAImageView::setCenterOrigin方法代码示例

本文整理汇总了C++中CAImageView::setCenterOrigin方法的典型用法代码示例。如果您正苦于以下问题:C++ CAImageView::setCenterOrigin方法的具体用法?C++ CAImageView::setCenterOrigin怎么用?C++ CAImageView::setCenterOrigin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CAImageView的用法示例。


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

示例1: onEnter

void CAPageControl::onEnter()
{
    CAControl::onEnter();
    
    if (m_pIndicators.size() != m_numberOfPages) {
        m_pIndicators.clear();
        
        for (int i=0; i<m_numberOfPages; i++) {
            CAImageView* view;
            if (i == m_currentPage) {
                view = CAImageView::createWithImage(m_pSelectPageImage);
                view->setColor(m_currentPageIndicatorTintColor);
            } else {
                view = CAImageView::createWithImage(m_pPageImage);        
                view->setColor(m_pageIndicatorTintColor);
            }
            
            CCRect rect;
            float width = getFrame().size.width/m_numberOfPages;
            rect.origin.x = i * width + width/2;
            rect.origin.y = getFrame().size.height/2;
            view->setCenterOrigin(rect.origin);
            
            addSubview(view);
            
            m_pIndicators.pushBack(view);
        }
    }
}
开发者ID:ancon,项目名称:CrossApp,代码行数:29,代码来源:CAPageControl.cpp

示例2: viewDidLoad

void ImageViewTest::viewDidLoad()
{
	size = this->getView()->getBounds().size;
	
	CALabel* ordinaryImage = CALabel::createWithCenter(CCRect(size.width*0.2,size.height*0.2,200,50));
	ordinaryImage->setText("Ordinary image:");
	ordinaryImage->setFontSize(30 * CROSSAPP_ADPTATION_RATIO);
	ordinaryImage->setColor(ccc4(51,204,255,255));
	ordinaryImage->setTextAlignment(CATextAlignmentCenter);
	this->getView()->addSubview(ordinaryImage);

	CAImageView* firstImage = CAImageView::createWithImage(CAImage::create("btn_rounded3D_normal.png"));
	firstImage->setCenterOrigin(CCPoint(size.width*0.4, size.height*0.2));
	this->getView()->addSubview(firstImage);

	CAImageView* secondImage = CAImageView::createWithImage(CAImage::create("btn_rounded3D_selected.png"));
	secondImage->setCenterOrigin(CCPoint(size.width*0.6, size.height*0.2));
	this->getView()->addSubview(secondImage);

	CAImageView* thirdImage = CAImageView::createWithImage(CAImage::create("slider_indicator.png"));
	thirdImage->setCenterOrigin(CCPoint(size.width*0.8, size.height*0.2));
	this->getView()->addSubview(thirdImage);

	CALabel* scale9Image = CALabel::createWithCenter(CCRect(size.width*0.2, size.height*0.5, 200, 50));
	scale9Image->setText("Scale9Image:");
	scale9Image->setFontSize(30 * CROSSAPP_ADPTATION_RATIO);
	scale9Image->setColor(ccc4(51, 204, 255, 255));
	scale9Image->setTextAlignment(CATextAlignmentCenter);
	this->getView()->addSubview(scale9Image);

	CAScale9ImageView* firstScale9Image = CAScale9ImageView::createWithImage(CAImage::create("btn_rounded3D_normal.png"));
	firstScale9Image->setCenter(CCRect(size.width*0.5, size.height*0.5, 200, 50));
	this->getView()->addSubview(firstScale9Image);

	CAScale9ImageView* secondScale9Image = CAScale9ImageView::createWithImage(CAImage::create("btn_rounded3D_selected.png"));
	secondScale9Image->setCenter(CCRect(size.width*0.5, size.height*0.6, 200, 50));
	this->getView()->addSubview(secondScale9Image);

	CAScale9ImageView* thirdScale9Image = CAScale9ImageView::createWithImage(CAImage::create("slider_indicator.png"));
	thirdScale9Image->setCenter(CCRect(size.width*0.5, size.height*0.7, 200, 50));
	this->getView()->addSubview(thirdScale9Image);
}
开发者ID:AojiaoZero,项目名称:CrossApp,代码行数:42,代码来源:ImageViewTest.cpp


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