本文整理汇总了C++中CCLabelAtlas::setPositionInPixels方法的典型用法代码示例。如果您正苦于以下问题:C++ CCLabelAtlas::setPositionInPixels方法的具体用法?C++ CCLabelAtlas::setPositionInPixels怎么用?C++ CCLabelAtlas::setPositionInPixels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCLabelAtlas
的用法示例。
在下文中一共展示了CCLabelAtlas::setPositionInPixels方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: useAutoSkill
//******************************************************************************
// useAutoSkill
//******************************************************************************
void Card::useAutoSkill(float fEffect, int iBaoJi)
{
float fDur = 0.0;
if(fEffect < -2.0){
fDur = 0.3;
}
else if(fEffect < 0.0){
fDur = 0.1;
}
else{
m_AtkInfo.iAttackPt *= fEffect;
m_numAtkVal->setNumber(m_AtkInfo.iAttackPt, 0.6, 0.0);
fDur = 0.3;
}
CCPoint ptSrc = CCPointMake(0, 0);
if (getCD() == 0)
ptSrc = CCPointMake(0, 8);
CCPoint ptDst = CCPointMake(ptSrc.x, ptSrc.y + 8);
this->stopAllActions();
this->setPositionInPixels(ptSrc);
this->runAction(CCSequence::actions(CCMoveTo::actionWithDuration(fDur, ptDst),
CCMoveTo::actionWithDuration(fDur, ptSrc),
NULL));
if (iBaoJi > 0) {
CCSprite* spBaojiBg = CCSprite::spriteWithSpriteFrameName("baojibg.png");
if (spBaojiBg) {
spBaojiBg->setAnchorPoint(CCPointMake(0.5, 0));
spBaojiBg->setPositionInPixels(CCPointMake(55 + 106*m_idx, 615 + m_spCard->getContentSize().height * 0.5));
addChild(spBaojiBg,0,kToBeDeleteTag);
}
CCSprite *sp = CCSprite::spriteWithFile("baojinum.png");
if (sp) {
char buf[10];
snprintf(buf, 9, "/%d", iBaoJi);
CCLabelAtlas *lbb = CCLabelAtlas::labelWithString(buf,
"baojinum.png",
sp->getContentSize().width / 11,
sp->getContentSize().height, '/');
lbb->setPositionInPixels(CCPointMake(55 + 106*m_idx, 615 + m_spCard->getContentSize().height * 0.5));
lbb->setAnchorPoint(CCPointMake(0.5, 0));
addChild(lbb,0,kToBeDeleteTag);
lbb->runAction(CCSequence::actions(CCDelayTime::actionWithDuration(fDur*2),
CCCallFunc::actionWithTarget(this, callfunc_selector(Card::delUnusedObj)),
NULL));
}
}
}