本文整理汇总了C++中CButton::setAnchorPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ CButton::setAnchorPoint方法的具体用法?C++ CButton::setAnchorPoint怎么用?C++ CButton::setAnchorPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CButton
的用法示例。
在下文中一共展示了CButton::setAnchorPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addTableCell
void CSharpTollgate::addTableCell(unsigned int uIdx, CTableViewCell * pCell)
{
const vector<StageWidget> *data = DataCenter::sharedData()->getStageData()
->getStageWidgets(m_chapter);
CStage &stage = m_stageList.at(uIdx);
for (int i = 0; i < 2; i++)
{
CCNode * node = (CCNode*)m_cell->getChildren()->objectAtIndex(i);
if (node->getTag()==1)
{
const StageWidget *widget = nullptr;
CCString *strId = CCString::createWithFormat("hero%d",uIdx+1);
for (int j=0; j<data->size();++j)
{
widget = &data->at(j);
if (widget->widgetId!=""&&widget->widgetId.compare(strId->getCString())==0)
{
CButton *btn = CButton::create(widget->normalImage.c_str());
btn->setScaleX(widget->scaleX);
btn->setScaleY(widget->scaleY);
btn->setPosition(ccp(100, 80/*btn->boundingBox().size.height*/));
btn->setAnchorPoint(ccp(0.5, 0.0));
btn->setUserData(&m_stageList.at(uIdx));
btn->setOnClickListener(this,ccw_click_selector(CSharpTollgate::onBattle));
btn->setTag(1);
pCell->addChild(btn);
if (!stage.isOpen)
{
btn->getNormalImage()->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
// btn->getSelectedImage()->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
}
break;
}
}
}
else if (node->getTag()==2)
{
CImageView *image = UICloneMgr::cloneImageView((CImageView*)node);
if (stage.star>0)
{
image->setTexture(CCTextureCache::sharedTextureCache()->addImage(CCString::createWithFormat("tollgate/star_%d.png",stage.star)->getCString()));
}
else
{
image->setTexture(CCTextureCache::sharedTextureCache()->addImage("tollgate/star_3.png"));
image->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
}
image->setAnchorPoint(ccp(0.5f,0));
pCell->addChild(image);
}
}
pCell->setVisible(false);
pCell->setScale(1.15f);
pCell->runAction(CCSequence::create(CCDelayTime::create(0.1f+0.15f*uIdx),CCShow::create(),CCScaleTo::create(0.05f,1.0f),CCCallFuncN::create(this,callfuncN_selector(CSharpTollgate::heroCall)),nullptr));
}