本文整理汇总了C++中CCSpriteBatchNode::initWithTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ CCSpriteBatchNode::initWithTexture方法的具体用法?C++ CCSpriteBatchNode::initWithTexture怎么用?C++ CCSpriteBatchNode::initWithTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCSpriteBatchNode
的用法示例。
在下文中一共展示了CCSpriteBatchNode::initWithTexture方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: batchNodeWithTexture
/*
* creation with CCTexture2D
*/
CCSpriteBatchNode* CCSpriteBatchNode::batchNodeWithTexture(cocos2d::CCTexture2D *tex)
{
CCSpriteBatchNode *batchNode = new CCSpriteBatchNode();
batchNode->initWithTexture(tex, defaultCapacity);
batchNode->autorelease();
return batchNode;
}
示例2: batchNodeWithTexture
CCSpriteBatchNode* CCSpriteBatchNode::batchNodeWithTexture(CCTexture2D* tex, unsigned int capacity)
{
CCSpriteBatchNode *batchNode = new CCSpriteBatchNode();
batchNode->initWithTexture(tex, capacity);
batchNode->autorelease();
return batchNode;
}
示例3: create
CCSpriteBatchNode* CCSpriteBatchNode::create(CCTexture2D* tex, unsigned int capacity/* = kDefaultSpriteBatchCapacity*/)
{
CCSpriteBatchNode *batchNode = new CCSpriteBatchNode();
batchNode->initWithTexture(tex, capacity);
batchNode->autorelease();
return batchNode;
}
示例4: createWithTexture
NS_CC_BEGIN
/*
* creation with CCTexture2D
*/
// 用纹理创建
CCSpriteBatchNode* CCSpriteBatchNode::createWithTexture(CCTexture2D* tex, unsigned int capacity/* = kDefaultSpriteBatchCapacity*/)
{
CCSpriteBatchNode *batchNode = new CCSpriteBatchNode();
batchNode->initWithTexture(tex, capacity);
batchNode->autorelease();
return batchNode;
}
示例5: createWithTexture
NS_CC_BEGIN
/*
* creation with CCTexture2D
*/
//静态函数:通过纹理指针按照设定的图块数量创建一个CCSpriteBatch实例对象。
CCSpriteBatchNode* CCSpriteBatchNode::createWithTexture(CCTexture2D* tex, unsigned int capacity/* = kDefaultSpriteBatchCapacity*/)
{
//使用new创建一个CCSpriteBatchNode实例对象。
CCSpriteBatchNode *batchNode = new CCSpriteBatchNode();
//使用纹理指针和默认图块数量对CCSpriteBatchNode实例对象进行初始化。
batchNode->initWithTexture(tex, capacity);
//设置其由内存管理器进行内存释放。
batchNode->autorelease();
//返回新创建的CCSpriteBatchNode实例对象
return batchNode;
}
示例6: createWithTexture
NS_CC_BEGIN
//
// creation with CCTexture2D
//
CCSpriteBatchNode* CCSpriteBatchNode::createWithTexture ( CCTexture2D* pTexture, KDuint uCapacity )
{
CCSpriteBatchNode* pRet = new CCSpriteBatchNode ( );
if ( pRet && pRet->initWithTexture ( pTexture, uCapacity ) )
{
pRet->autorelease ( );
}
else
{
CC_SAFE_DELETE ( pRet );
}
return pRet;
}
示例7: init
bool ComicScene::init() {
if ( !CCLayer::init() ) {
return false;
}
this->setIsKeypadEnabled(true);
CCDirector::sharedDirector()->resume();
this->touchEnabled=true;
this->currentPage = 0;
this->cleanAfterExit = false;
CCSpriteBatchNode* batch = new CCSpriteBatchNode();
batch->initWithTexture(CCTextureCache::sharedTextureCache()->textureForKey(Config::sharedConfig()->COMIC_PNG.c_str()), 6);
this->addChild(batch, 0, BATCH_COMIC_INTRO_TAG);
CCSprite* gSettingBackground = CCSprite::spriteWithSpriteFrameName(COMIC_INTRO_BG.c_str());
gSettingBackground->setPosition(Geometry::getScreenCenter());
this->addChild(gSettingBackground, 0);
CCLabelBMFont* labelTouch = CCLabelBMFont::labelWithString(Config::sharedConfig()->LANG_CONTINUE.c_str(), Config::sharedConfig()->BMFONT_NAME.c_str());
labelTouch->setColor(ccc3(50,50,50));
labelTouch->setScale(0.7);
labelTouch->setPosition( CCPoint(Geometry::getScreenBotomCenter(24)) );
this->addChild(labelTouch, 2, 100);
if(!SimpleAudioEngine::sharedEngine()->isBackgroundMusicPlaying() && SimpleAudioEngine::sharedEngine()->getBackgroundMusicVolume() > 0) {
SimpleAudioEngine::sharedEngine()->playBackgroundMusic(CCFileUtils::fullPathFromRelativePath(MUSIC_LEVEL2.c_str()), true);
}
CCSprite* sPage1;
CCSprite* sPage2;
CCSprite* sPage3;
CCLabelBMFont* sText1;
CCLabelBMFont* sText2;
CCLabelBMFont* sText3;
if (sequence == 1) {
sPage1 = CCSprite::spriteWithSpriteFrameName(COMIC_INTRO_1.c_str());
sPage1->setPosition( CCPoint(Geometry::getScreenBotomCenter(Config::sharedConfig()->COMIC_ADJUST_PAGE_A)) );
sPage1->setOpacity(0);
this->addChild(sPage1, 1, 1);
sText1 = CCLabelBMFont::labelWithString(Config::sharedConfig()->LANG_COMIC_TEXT_1.c_str(), Config::sharedConfig()->BMFONT_NAME.c_str());
sText1->setColor(ccc3(45,0,0));
sText1->setPosition( CCPoint(Geometry::getScreenUpCenter(-Config::sharedConfig()->COMIC_ADJUST_TXT_A)) );
this->addChild(sText1, 1, 2);
sPage2 = CCSprite::spriteWithSpriteFrameName(COMIC_INTRO_2.c_str());
sPage2->setPosition( CCPoint(Geometry::getScreenBotomCenter(Config::sharedConfig()->COMIC_ADJUST_PAGE_B)) );
sPage2->setOpacity(0);
this->addChild(sPage2, 1, 3);
sText2 = CCLabelBMFont::labelWithString(Config::sharedConfig()->LANG_COMIC_TEXT_2.c_str(), Config::sharedConfig()->BMFONT_NAME.c_str());
sText2->setColor(ccc3(45,0,0));
sText2->setPosition( CCPoint(Geometry::getScreenUpCenterAdjust(-Config::sharedConfig()->SCREEN_WIDTH,Config::sharedConfig()->COMIC_ADJUST_TXT_C)) );
this->addChild(sText2, 1, 4);
sPage3 = CCSprite::spriteWithSpriteFrameName(COMIC_INTRO_3.c_str());
sPage3->setPosition( CCPoint(Geometry::getScreenBotomCenter(Config::sharedConfig()->COMIC_ADJUST_PAGE_C)) );
sPage3->setOpacity(0);
this->addChild(sPage3, 1, 5);
sText3 = CCLabelBMFont::labelWithString(Config::sharedConfig()->LANG_COMIC_TEXT_3.c_str(), Config::sharedConfig()->BMFONT_NAME.c_str());
sText3->setColor(ccc3(45,0,0));
sText3->setPosition( CCPoint(Geometry::getScreenUpCenterAdjust(Config::sharedConfig()->SCREEN_WIDTH,Config::sharedConfig()->COMIC_ADJUST_TXT_C)) );
this->addChild(sText3, 1, 6);
this->totalPages = 3;
} else if (sequence == 2) {
sPage1 = CCSprite::spriteWithSpriteFrameName(COMIC_END_1.c_str());
sPage1->setPosition( CCPoint(Geometry::getScreenBotomCenter(Config::sharedConfig()->COMIC_ADJUST_PAGE_A)) );
sPage1->setOpacity(0);
this->addChild(sPage1, 1, 1);
sText1 = CCLabelBMFont::labelWithString(Config::sharedConfig()->LANG_COMIC_TEXT_4.c_str(), Config::sharedConfig()->BMFONT_NAME.c_str());
sText1->setColor(ccc3(45,0,0));
sText1->setPosition( CCPoint(Geometry::getScreenUpCenterAdjust(-Config::sharedConfig()->SCREEN_WIDTH,Config::sharedConfig()->COMIC_ADJUST_TXT_A)) );
this->addChild(sText1, 1, 2);
sPage2 = CCSprite::spriteWithSpriteFrameName(COMIC_END_2.c_str());
sPage2->setPosition( CCPoint(Geometry::getScreenBotomCenter(Config::sharedConfig()->COMIC_ADJUST_PAGE_E)) );
sPage2->setOpacity(0);
this->addChild(sPage2, 1, 3);
sText2 = CCLabelBMFont::labelWithString(Config::sharedConfig()->LANG_COMIC_TEXT_5.c_str(), Config::sharedConfig()->BMFONT_NAME.c_str());
sText2->setColor(ccc3(45,0,0));
sText2->setPosition( CCPoint(Geometry::getScreenUpCenterAdjust(Config::sharedConfig()->SCREEN_WIDTH,Config::sharedConfig()->COMIC_ADJUST_TXT_E)) );
this->addChild(sText2, 1, 4);
this->totalPages = 2;
}
showCurrentPage();
CCTouchDispatcher::sharedDispatcher()->addTargetedDelegate(this, 0, true);
//ipad fix
if(CCDirector::sharedDirector()->getWinSizeInPixels().width >= 768) {
Border* border = new Border();
this->addChild(border, 999);
}
return true;
}