本文整理汇总了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);
}
}
}
示例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);
}