本文整理汇总了C++中CCClippingNode::runAction方法的典型用法代码示例。如果您正苦于以下问题:C++ CCClippingNode::runAction方法的具体用法?C++ CCClippingNode::runAction怎么用?C++ CCClippingNode::runAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCClippingNode
的用法示例。
在下文中一共展示了CCClippingNode::runAction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
void NestedTest::setup()
{
static int depth = 9;
CCNode *parent = this;
for (int i = 0; i < depth; i++) {
int size = 225 - i * (225 / (depth * 2));
CCClippingNode *clipper = CCClippingNode::create();
clipper->setContentSize(CCSizeMake(size, size));
clipper->setAnchorPoint(ccp(0.5, 0.5));
clipper->setPosition( ccp(parent->getContentSize().width / 2, parent->getContentSize().height / 2) );
clipper->setAlphaThreshold(0.05f);
clipper->runAction(CCRepeatForever::create(CCRotateBy::create(i % 3 ? 1.33 : 1.66, i % 2 ? 90 : -90)));
parent->addChild(clipper);
CCNode *stencil = CCSprite::create(s_pPathGrossini);
stencil->setScale( 2.5 - (i * (2.5 / depth)) );
stencil->setAnchorPoint( ccp(0.5, 0.5) );
stencil->setPosition( ccp(clipper->getContentSize().width / 2, clipper->getContentSize().height / 2) );
stencil->setVisible(false);
stencil->runAction(CCSequence::createWithTwoActions(CCDelayTime::create(i), CCShow::create()));
clipper->setStencil(stencil);
clipper->addChild(stencil);
parent = clipper;
}
}
示例2: CCRectMake
bool Recipe26::init()
{
if ( !RecipeBase::init() )
{
return false;
}
CCLayerColor* panelBg = CCLayerColor::create(ccc4(51, 51, 51, 255),640,1150);
panelBg->setPosition(ccp(0,0));
this->addChild(panelBg);
targetLayer = CCLayer::create();
this->addChild(targetLayer);
// 画面の幅を取得
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
// 画像ファイルとrectを指定してスプライトを作成
CCSprite *player = CCSprite::create("image/quest/shuriken_m_avatar_skillpg_18.png", CCRectMake(0, 0, 100, 100) );
// スプライトの位置を設定
player->setPosition(ccp(player->getContentSize().width*3/2, winSize.height/2));
// 後で識別できるようにタグを設定
player->setTag(1);
// スプライトをレイヤに追加
targetLayer->addChild(player);
CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
TapSprite* sprite = (TapSprite*)TapSprite::create("image/quest/shuriken_m_avatar_skillpg_18.png");
sprite->setPosition(ccp(visibleSize.width/2, visibleSize.height/2));
sprite->setTag(2);
targetLayer->addChild(sprite);
// クリック用のボタン
CCMenuItemImage *pCloseItem = CCMenuItemImage::create(
"image/ui/common_ui_mainButton_up.png",
"image/ui/common_ui_mainButton_down.png",
this,
menu_selector(Recipe26::testBtn1Handler));
// 表示位置を指定
pCloseItem->setPosition(ccp(winSize.width - pCloseItem->getContentSize().width / 2 ,
pCloseItem->getContentSize().height / 2));
// CCMenuItemImage から CCMenuを作成
CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
// CCMenuとしての位置は(0,0)を指定
pMenu->setPosition(-150,130);
this->addChild(pMenu);
//---------------------------
CCSize size = CCDirector::sharedDirector()->getVisibleSize();
CCSprite* pSprite = CCSprite::create("image/gacha/2204401.jpg");
pSprite->setPosition( ccp(size.width/2, size.height/2) );
CCSprite* pMask = CCSprite::create("image/quest/mask_star.png");
pMask->setPosition(ccp(size.width/2, size.height/2));
CCClippingNode* pClip = CCClippingNode::create();
pClip->setStencil(pMask);
pClip->setAlphaThreshold(0.05f);
pClip->addChild(pSprite);
targetLayer->addChild(pClip);
CCMoveTo *actionMove = CCMoveTo::create(1.7f, ccp(200, 500));
pClip->runAction(CCEaseExponentialInOut::create(actionMove));
//---------------------------
// 配列のテスト
//---------------------------
int arrN[] = {5,6,9,4};
int iSize = sizeof(arrN) / sizeof(arrN[0]);
for ( int i = 0 ; i < iSize ; i++ ) {
CCLOG("ffgff : %i" , arrN[i]);
}
return true;
}