本文整理汇总了C++中CCRotateBy类的典型用法代码示例。如果您正苦于以下问题:C++ CCRotateBy类的具体用法?C++ CCRotateBy怎么用?C++ CCRotateBy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCRotateBy类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: INSTANCE
void BossLottery::btnHandler()
{
int cost = INSTANCE(SystemConfigRule)->getBossLotteryCost();
if(times > 1){
if(cost >= INSTANCE(UserData)->getCurrentMoney()){
INSTANCE(MessageBoxFacade)->showMessageBox("元宝不足,是否充值?", INSTANCE(RechargeFacade), callfunc_selector(RechargeFacade::open),"充值");
return;
}
INSTANCE(UserData)->costCurrentMoney(cost);
INSTANCE(MoneyLayerManager)->createReduceMoney(cost);
}
CCNotificationCenter::sharedNotificationCenter()->postNotification(NoticeUpdateMoney);
btn->setEnabled(false);
closeBtn->setEnabled(false);
int r = INSTANCE(SystemConfigRule)->getWheelMultiple();
result = getMultiple(r);
INSTANCE(BossLotteryFacade)->setBossMultiple(result);
CCRotateBy *rotate = CCRotateBy::create(4.0f, 3600 + r * 60 - 30);
CCEaseInOut *easeInOut = CCEaseInOut::create((CCActionInterval *)rotate->copy()->autorelease(), 1.5f);
CCSequence *action = CCSequence::create(easeInOut,CCCallFunc::create(this, callfunc_selector(BossLottery::rotateComplete)),NULL);
circle->setRotation(0);
circle->runAction(action);
costLabel->setString(CCString::createWithFormat("消耗%d元宝",cost)->getCString());
INSTANCE(UserData)->addWheelTimes(1);
times++;
}
示例2:
//------------------------------------------------------------------
//
// Test5
//
//------------------------------------------------------------------
Test5::Test5()
{
CCSprite* sp1 = CCSprite::spriteWithFile(s_pPathSister1);
CCSprite* sp2 = CCSprite::spriteWithFile(s_pPathSister2);
sp1->setPosition(CCPointMake(100,160));
sp2->setPosition(CCPointMake(380,160));
CCRotateBy* rot = CCRotateBy::actionWithDuration(2, 360);
CCActionInterval* rot_back = rot->reverse();
CCAction* forever = CCRepeatForever::actionWithAction(
(CCActionInterval*)(CCSequence::actions(rot, rot_back, NULL))
);
CCAction* forever2 = (CCAction*)(forever->copy()->autorelease());
forever->setTag(101);
forever2->setTag(102);
addChild(sp1, 0, kTagSprite1);
addChild(sp2, 0, kTagSprite2);
sp1->runAction(forever);
sp2->runAction(forever2);
schedule( schedule_selector(Test5::addAndRemove), 2.0f);
}
示例3: CCRotateBy
//
// RotateBy
//
CCRotateBy* CCRotateBy::actionWithDuration(ccTime duration, float fDeltaAngle)
{
CCRotateBy *pRotateBy = new CCRotateBy();
pRotateBy->initWithDuration(duration, fDeltaAngle);
pRotateBy->autorelease();
return pRotateBy;
}
示例4: CCRotateBy
CCRotateBy* CCRotateBy::create(float fDuration, float fDeltaAngleX, float fDeltaAngleY)
{
CCRotateBy *pRotateBy = new CCRotateBy();
pRotateBy->initWithDuration(fDuration, fDeltaAngleX, fDeltaAngleY);
pRotateBy->autorelease();
return pRotateBy;
}
示例5:
CCAction *SudokuActionManager::createFailInputCellAction(CCPoint pt){
CCMoveBy *acMove = CCMoveBy::create(0.2,pt);
CCRotateBy *rotate = CCRotateBy::create(0.2,80.f);
CCJumpBy *jump = CCJumpBy::create(0.5,ccp(0,0),25,5);
CCSequence *inputCellAction = CCSequence::create(acMove,rotate, rotate->reverse(), acMove->reverse(), jump, NULL);
return inputCellAction;
}
示例6: performanceActions
////////////////////////////////////////////////////////
//
// For test functions
//
////////////////////////////////////////////////////////
void performanceActions(CCSprite* pSprite)
{
CCSize size = CCDirector::sharedDirector()->getWinSize();
pSprite->setPosition(ccp((rand() % (int)size.width), (rand() % (int)size.height)));
float period = 0.5f + (rand() % 1000) / 500.0f;
CCRotateBy* rot = CCRotateBy::create(period, 360.0f * CCRANDOM_0_1());
CCActionInterval* rot_back = rot->reverse();
CCAction *permanentRotation = CCRepeatForever::create((CCActionInterval *)CCSequence::create(rot, rot_back, NULL));
pSprite->runAction(permanentRotation);
float growDuration = 0.5f + (rand() % 1000) / 500.0f;
CCActionInterval *grow = CCScaleBy::create(growDuration, 0.5f, 0.5f);
CCAction *permanentScaleLoop = CCRepeatForever::create((CCActionInterval *)CCSequence::create(grow, grow->reverse()));
pSprite->runAction(permanentScaleLoop);
}
示例7: handlerTouchInSquare
void HelloWorld::ccTouchEnded(cocos2d::CCTouch *pTouches, cocos2d::CCEvent *pEvent){
if(m_score<0){
return;
}
CCPoint point = pTouches->getLocation();
char pos[100];
int y_ = (int)((point.y-diamondRect.origin.y)/dh);
int y = 7-y_;
int x = (int)((point.x-diamondRect.origin.x)/dw);
int result[64] = {0};
if(y>=8||x>=8){
return;
}
int count = handlerTouchInSquare(y*8+x, result);
if(count < 3)
return;
for(int i = 0; i < count; i++){
CCSprite *sprite = diamonds[result[i]];
CCRotateBy *rotateAct = new CCRotateBy();
rotateAct->initWithDuration(0.2f, 90.0f);
sprite->runAction(rotateAct);
char str[20];
CCImage *image = new CCImage();
int color = getDiamond(str);
base[result[i]] = color;
image->initWithImageFile(str, CCImage::kFmtJpg);
CCTexture2D* texture = new CCTexture2D();
texture->initWithImage(image);
sprite->setTexture(texture);
}
//delete rotateAct;
m_score += 5*count;
char str[20];
sprintf(str, "Score: %d", m_score);
pLabelScore->setString(str);
//fflush(file);
}
示例8: CCBLoadFile
bool FlySystemUpdateHint::init()
{
CCSafeNotificationCenter::sharedNotificationCenter()->postNotification("remove_hint");
CCBLoadFile("FlySystemUpdateHint", this, this);
// auto layer = SceneController::getInstance()->getCurrentLayerByLevel(LEVEL_TIP);
// layer->addChild(this,1000);
// auto size = CCDirector::sharedDirector()->getWinSize();
// this->setPosition(ccp(size.width / 2, size.height-210));
// this->setPosition(ccp(230, 185));
// this->setPosition(ccp(size.width / 2, 185));
if(m_type == FLY_HINT_SHAKEALLIANCE){
m_shakeSp->setVisible(true);
CCRotateBy * roaction = CCRotateBy::create(0.1f,60);
CCRepeat * r1 = CCRepeat::create(CCSequence::create(roaction,roaction->reverse(),nullptr),4);
CCDelayTime * d = CCDelayTime::create(1.0f);
m_shakeSp->runAction(CCRepeatForever::create(CCSequence::create(r1,d,nullptr)));
}else{
m_shakeSp->setVisible(false);
}
double curTime = GlobalData::shared()->getWorldTime();
m_countDown = GlobalData::shared()->changeTime(m_countDown/1000);
m_time = (long)floor( m_countDown - curTime );
string delayTime = CC_ITOA(m_time/60);
//delayTime.append("m");
if(m_type==FLY_HINT_KING && m_icon==""){
string temp = "";
int num = 2;
for (int i=0; i<num; i++) {
temp.append(m_tip);
if(i!=1){
temp.append(" ");
}
}
m_tip = temp;
}
m_rollText = FlyRollingText::create(m_tip.c_str(), 320, 24, ccc3(245,233,215), 60, 1,m_icon);
m_rollTime = m_rollText->getRollingTime();
this->setScaleY(0);
one = CCSequence::create(CCCallFunc::create(this, callfunc_selector(FlySystemUpdateHint::showUIQuestNode))
,CCScaleTo::create(0.2, 1, 1)
, CCCallFunc::create(this, callfunc_selector(FlySystemUpdateHint::rollText))
, CCDelayTime::create(m_rollTime)
, CCScaleTo::create(0.4, 1, 0)
, CCCallFunc::create(this, callfunc_selector(FlySystemUpdateHint::hideUIQuestNode))
, NULL
);
if (CCCommonUtils::isIosAndroidPad() && CCCommonUtils::getIsHDViewPort())
{
one = CCSequence::create(CCCallFunc::create(this, callfunc_selector(FlySystemUpdateHint::showUIQuestNode))
,CCScaleTo::create(0.2, 2, 2)
, CCCallFunc::create(this, callfunc_selector(FlySystemUpdateHint::rollText))
, CCDelayTime::create(m_rollTime)
, CCScaleTo::create(0.4, 2, 0)
, CCCallFunc::create(this, callfunc_selector(FlySystemUpdateHint::hideUIQuestNode))
, NULL);
}
m_btnClose->setVisible(m_type==FLY_HINT_WAR);
return true;
}
示例9: setCleanFunction
bool IFShakeGuideLayer::initData()
{
this->setVisible(false);
m_defaultWidth = 140;
if (CCCommonUtils::isIosAndroidPad())
{
m_defaultWidth = 240;
}
CCLoadSprite::doResourceByCommonIndex(500, true);
setCleanFunction([](){
CCLoadSprite::doResourceByCommonIndex(500, false);
});
CCBLoadFile("shakeGuideLayer",this,this);
string infoStr("");
int guideTime = CCUserDefault::sharedUserDefault()->getIntegerForKey(MSG_SHAKEGUIDETIME, 0);
string shakePicStr = GlobalData::shared()->shakePicStr;
vector<string> picVec ;
CCCommonUtils::splitString(shakePicStr, "|", picVec);
int count = picVec.size();
int index = -1;
if(count > 0 ){
index = rand() % count;
}
if (m_forceShake) {
string picStr = "g007.png";
auto m_pic= CCLoadSprite::createSprite(picStr.c_str());
CCCommonUtils::setSpriteMaxSize(m_pic, 100);
m_head->addChild(m_pic);
}
if (index != -1) {
m_headImgNode = HFHeadImgNode::create();
m_headImgNode->initHeadImgUrl2(m_head, CCCommonUtils::getShakePicUrl(picVec[index]), 1.0f, 100, true);
CCLOG("shakelog: picUrl%s",CCCommonUtils::getShakePicUrl(picVec[index]).c_str());
}
schedule(schedule_selector(IFShakeGuideLayer::monitorPic), 0.5);
m_startTime = WorldController::getInstance()->getTime()/1000;
if (guideTime == 0) {
infoStr = _lang("113100");
}else if (guideTime == 1){
infoStr = _lang("113108");
}else if (guideTime == 2){
infoStr = _lang("113103");
}else{
int randContainerArr[] = {113100,113101,113102,113103,113108,113109};
int randNUm = rand() % 6;
CCLOG("shakelog: randnum %d",randNUm);
infoStr = _lang(CC_ITOA(randContainerArr[randNUm]));
}
if (m_forceShake) {
infoStr = _lang("113103");
}
m_hintText->setString(infoStr.c_str());
CCUserDefault::sharedUserDefault()->setIntegerForKey(MSG_SHAKEGUIDETIME, ++guideTime);
m_shakeSp->stopAllActions();
CCRotateBy * roaction = CCRotateBy::create(0.1f,60);
CCRepeat * r1 = CCRepeat::create(CCSequence::create(roaction,roaction->reverse(),nullptr),4);
CCDelayTime * d = CCDelayTime::create(2.0f);
m_shakeSp->runAction(CCRepeatForever::create(CCSequence::create(r1,d,nullptr)));
m_bgNode->setVisible(false);
m_bgNode->retain();
m_bgNode->removeFromParent();
m_clipNode = CCClipNode::create(modelWidth, 150);
if (CCCommonUtils::isIosAndroidPad())
{
m_clipNode = CCClipNode::create(modelWidth, 320);
}
m_clipNode->setAnchorPoint(ccp(0, 0));
m_clipNode->addChild(m_bgNode);
m_bgNode->release();
this->addChild(m_clipNode);
// auto btnPic1 = CCLoadSprite::createScale9Sprite("Mail_btn03.png");
// if(btnPic1){
// btnPic1->setScale(0.8);
// m_btnNode->addChild(btnPic1);
// }
return true;
}