本文整理汇总了C++中CCSpriteBatchNode::setPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ CCSpriteBatchNode::setPosition方法的具体用法?C++ CCSpriteBatchNode::setPosition怎么用?C++ CCSpriteBatchNode::setPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCSpriteBatchNode
的用法示例。
在下文中一共展示了CCSpriteBatchNode::setPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createFish
void SoulPrev::createFish(const CCPoint& point) {
//use CCSpriteBachNode to draw texture
CCTexture2D* texture = CCTextureCache::sharedTextureCache()->textureForKey("fish.png");
CCSpriteBatchNode* spbatch = CCSpriteBatchNode::createWithTexture(texture);
spbatch->setPosition(ccp(0, 0));
this->addChild(spbatch);
CCSprite* sprite = CCSprite::createWithSpriteFrameName("hudieyu_72.png");
sprite->setPosition(point);
sprite->setPosition(point);
spbatch->addChild(sprite);
}
示例2: __initLighting
void HomeScene::__initLighting()
{
const int deg = 30;
CCSpriteBatchNode *pLightingNode = CCSpriteBatchNode::createWithTexture(SPRITE("[email protected]")->getTexture());
for(int i=0; i<6; i++)
{
CCSprite *light = SPRITE("[email protected]");
light->setRotation(i*deg);
light->setScale(2);
pLightingNode->addChild(light);
}
ccBlendFunc cbl = {GL_DST_COLOR, GL_ONE};
pLightingNode->setBlendFunc(cbl);
pLightingNode->setPosition(VisibleRect::center());
addChild(pLightingNode);
//使光芒开始旋转
CCRotateBy *rotateAct = CCRotateBy::create(1,30);
pLightingNode->runAction(CCRepeatForever::create(rotateAct));
}
示例3: init
bool StoryWorld::init() {
if ( !CCLayer::init() ) {
return false;
}
char theName[10][11]={"","穆婧:", "子轩:", "少杰:", "建国", "路人A:", "路人B:", "路人C:", "老爷爷:", "江姐:"};
char play[20] = SCRIPT_PATH;
current=sGlobal->mapState->storyCnt+'0';
play[SCRIPT_PATH_LEN] = current;
reader.ReadFileWithFullPath(CCFileUtils::sharedFileUtils()->fullPathForFilename(play));
this->setTouchEnabled(true);
CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();
char bg_name[30] = "" ;
char bg_num[4]="";
sprintf(bg_num, "%c00", current);
sprintf(bg_name, BGNAME_IMG_PATH, bg_num);
CCSprite *pBackground = CCSprite::createWithTexture(GET_TEXTURE(bg_name));
//CCSprite* pBackground = CCSprite::create(bg_name);
pBackground->setPosition(ccp(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
pBackground->setScale(1);
pBackground->setTag(108);
addChild(pBackground, 0);
CCSprite* dialogBox = CCSprite::create(DUIHUAKUANG_IMG_PATH);
dialogBox->setPosition(ccp(visibleSize.width/2, dialogBox->getContentSize().height/2));
dialogBox->setOpacity(220);
addChild(dialogBox,1);
CCLabelTTF* pName = CCLabelTTF::create(theName[0], "Heiti SC", 40);
pName->setTag(101);
pName->setPosition(ccp(pName->getContentSize().width/2, dialogBox->getContentSize().height - 2 * pName->getContentSize().height));
pName->setAnchorPoint(CCPointZero);
addChild(pName, 1);
CCLabelTTF* pLabel = CCLabelTTF::create("Click to Start", "Heiti SC", 40);
pLabel->setTag(100);
pLabel->setPosition(ccp(40, origin.y + dialogBox->getContentSize().height - 3.4 * pLabel->getContentSize().height));
pLabel->setAnchorPoint(CCPointZero);
pLabel->setDimensions(CCSizeMake(1100, 0));
pLabel->setHorizontalAlignment(kCCTextAlignmentLeft);
addChild(pLabel, 1);
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(PLIST_IMG_PATH);
CCSpriteBatchNode *spriteBatch = CCSpriteBatchNode::createWithTexture(GET_TEXTURE(VDRAWING_IMG_PATH));
spriteBatch->setTag(102);
addChild(spriteBatch, 0);
spriteBatch->setPosition(CCPointZero);
CCSprite *leftSprite=CCSprite::createWithSpriteFrameName("me_1.png");
leftSprite->setScale(0.8);
leftSprite->setPosition(ccp(leftSprite->getContentSize().width*0.6, leftSprite->getContentSize().height/2 *0.8));
leftSprite->setTag(1);
leftSprite->setOpacity(0);
spriteBatch->addChild(leftSprite, 0);
CCSprite *rightSprite=CCSprite::createWithSpriteFrameName("blank.png");
//rightSprite->setScale(0.8);
rightSprite->setPosition(ccp(800, 130));
rightSprite->setTag(2);
rightSprite->setOpacity(0);
spriteBatch->addChild(rightSprite, 0);
avgGame();
return true;
}