本文整理汇总了C++中CCMenuItem::runAction方法的典型用法代码示例。如果您正苦于以下问题:C++ CCMenuItem::runAction方法的具体用法?C++ CCMenuItem::runAction怎么用?C++ CCMenuItem::runAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCMenuItem
的用法示例。
在下文中一共展示了CCMenuItem::runAction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CCPointMake
//------------------------------------------------------------------
//
// NodeToWorld
//
//------------------------------------------------------------------
NodeToWorld::NodeToWorld()
{
//
// This code tests that nodeToParent works OK:
// - It tests different anchor Points
// - It tests different children anchor points
CCSprite *back = CCSprite::spriteWithFile(s_back3);
addChild( back, -10);
back->setAnchorPoint( CCPointMake(0,0) );
CCSize backSize = back->getContentSize();
CCMenuItem *item = CCMenuItemImage::itemFromNormalImage(s_PlayNormal, s_PlaySelect);
CCMenu *menu = CCMenu::menuWithItems(item, NULL);
menu->alignItemsVertically();
menu->setPosition( CCPointMake(backSize.width/2, backSize.height/2));
back->addChild(menu);
CCActionInterval* rot = CCRotateBy::actionWithDuration(5, 360);
CCAction* fe = CCRepeatForever::actionWithAction( rot);
item->runAction( fe );
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(200,0));
CCActionInterval* move_back = move->reverse();
CCFiniteTimeAction* seq = CCSequence::actions( move, move_back, NULL);
CCAction* fe2 = CCRepeatForever::actionWithAction((CCActionInterval*)seq);
back->runAction(fe2);
}
示例2: addChild
//------------------------------------------------------------------
//
// NodeToWorld
//
//------------------------------------------------------------------
NodeToWorld::NodeToWorld()
{
//
// This code tests that nodeToParent works OK:
// - It tests different anchor Points
// - It tests different children anchor points
CCSprite *back = CCSprite::create(s_back3);
addChild( back, -10);
back->setAnchorPoint( ccp(0,0) );
CCSize backSize = back->getContentSize();
CCMenuItem *item = CCMenuItemImage::create(s_PlayNormal, s_PlaySelect);
CCMenu *menu = CCMenu::create(item, NULL);
menu->alignItemsVertically();
menu->setPosition( ccp(backSize.width/2, backSize.height/2));
back->addChild(menu);
CCActionInterval* rot = CCRotateBy::create(5, 360);
CCAction* fe = CCRepeatForever::create( rot);
item->runAction( fe );
CCActionInterval* move = CCMoveBy::create(3, ccp(200,0));
CCActionInterval* move_back = move->reverse();
CCSequence* seq = CCSequence::create( move, move_back, NULL);
CCAction* fe2 = CCRepeatForever::create(seq);
back->runAction(fe2);
}
示例3: Call
void HSPropIconInterface::Call( CCObject* pObj )
{
CCMenuItem* pItem = dynamic_cast<CCMenuItem*>(pObj);
CCBlink* pBink = CCBlink::create(0.2f,1);
pItem->runAction(pBink);
}