本文整理汇总了C++中CCSprite::autorelease方法的典型用法代码示例。如果您正苦于以下问题:C++ CCSprite::autorelease方法的具体用法?C++ CCSprite::autorelease怎么用?C++ CCSprite::autorelease使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCSprite
的用法示例。
在下文中一共展示了CCSprite::autorelease方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: spriteWithFile
CCSprite* CCSprite::spriteWithFile(const char *pszFileName, CGRect rect)
{
CCSprite *pobSprite = new CCSprite();
pobSprite->initWithFile(pszFileName, rect);
pobSprite->autorelease();
return pobSprite;
}
示例2: spriteWithTexture
CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture)
{
CCSprite *pobSprite = new CCSprite();
pobSprite->initWithTexture(pTexture);
pobSprite->autorelease();
return pobSprite;
}
示例3: spriteWithSpriteFrame
CCSprite* CCSprite::spriteWithSpriteFrame(CCSpriteFrame *pSpriteFrame)
{
CCSprite *pobSprite = new CCSprite();
pobSprite->initWithSpriteFrame(pSpriteFrame);
pobSprite->autorelease();
return pobSprite;
}
示例4: CreatGameUIWithSprite
//--------------------------------------------------------------------------------------------------------------------
//
//
CCMenu* CreatGameUIWithSprite( CCSprite* pSprite, SEL_MenuHandler callback, int Id, SelectorProtocol *target, CCPoint pos )
{
CCSprite *spriteNormal = new CCSprite();
spriteNormal->initWithTexture(pSprite->getTexture());
spriteNormal->autorelease();
CCSprite *spriteSelected = new CCSprite();
spriteSelected->initWithTexture(spriteNormal->getTexture());
spriteSelected->autorelease();
spriteSelected->setColor(ccc3( 100,100,100 ));
CCMenuItemSprite* item1 = CCMenuItemSprite::itemFromNormalSprite(spriteNormal, spriteSelected, target, callback );
item1->setTag( Id );
CCMenu* pMenu = CCMenu::menuWithItems( item1, NULL);
pMenu->setPosition( pos );
return pMenu;
}
示例5: spriteWithFile
CCSprite* CCSprite::spriteWithFile(const char *pszFileName)
{
CCSprite *pobSprite = new CCSprite();
if (pobSprite && pobSprite->initWithFile(pszFileName))
{
pobSprite->autorelease();
return pobSprite;
}
CC_SAFE_DELETE(pobSprite);
return NULL;
}
示例6: createWithTexture
CCSprite* CCSprite::createWithTexture(CCTexture2D *pTexture, const CCRect& rect)
{
CCSprite *pobSprite = new CCSprite();
if (pobSprite && pobSprite->initWithTexture(pTexture, rect))
{
pobSprite->autorelease();
return pobSprite;
}
CC_SAFE_DELETE(pobSprite);
return NULL;
}
示例7: createWithSpriteFrame
CCSprite* CCSprite::createWithSpriteFrame(CCSpriteFrame *pSpriteFrame)
{
CCSprite *pobSprite = new CCSprite();
if (pSpriteFrame && pobSprite && pobSprite->initWithSpriteFrame(pSpriteFrame))
{
pobSprite->autorelease();
return pobSprite;
}
CC_SAFE_DELETE(pobSprite);
return NULL;
}
示例8: create
CCSprite* CCSprite::create()
{
CCSprite *pSprite = new CCSprite();
if (pSprite && pSprite->init())
{
pSprite->autorelease();
return pSprite;
}
CC_SAFE_DELETE(pSprite);
return NULL;
}
示例9: spriteWithTexture
CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture)
{
CCSprite *pobSprite = new CCSprite();
if (pobSprite && pobSprite->initWithTexture(pTexture))
{
pobSprite->autorelease();
return pobSprite;
}
CC_SAFE_DELETE(pobSprite);
return NULL;
}
示例10: node
CCSprite* CCSprite::node()
{
CCSprite *pSprite = new CCSprite();
if (pSprite && pSprite->init())
{
pSprite->autorelease();
}
else
{
CC_SAFE_DELETE(pSprite);
}
return pSprite;
}
示例11: spriteWithBatchNode
CCSprite* CCSprite::spriteWithBatchNode(CCSpriteBatchNode *batchNode, CGRect rect)
{
CCSprite *pobSprite = new CCSprite();
if (pobSprite->initWithBatchNode(batchNode, rect))
{
pobSprite->autorelease();
}
else
{
delete pobSprite;
pobSprite = NULL;
}
return pobSprite;
}
示例12: doAction
void ShineEffectAction::doAction(TouchNode *node,bool enable)
{
CCSize spriteSize;
if(m_sprites.size() == 0){
node->getShowSprite(m_sprites,spriteSize);
for(unsigned int i = 0;i < m_sprites.size();i++){
BasAreaSkin *skin = dynamic_cast<BasAreaSkin*>(m_sprites[i]);
if(skin){
CCSprite *sprite = skin->clone();
if(sprite){
skin->addChild(sprite,-1);
sprite->autorelease();
sprite->setAnchorPoint(ccp(0.5,0.5));
CCSize csize = sprite->getContentSize();
sprite->setPosition(ccp(csize.width/2,csize.height/2));
m_createSprites.push_back(sprite);
}
}
}
}
if(m_sprites.size() == 0){
return;
}
if(m_running == enable)
return;
m_running = enable;
if(m_running){
float runtime = 0.5;
for(unsigned int i = 0;i < m_createSprites.size();i++){
CCSprite *sprite = m_createSprites[i];
sprite->setScale(1.05);
CCScaleTo *scaleTo = CCScaleTo::create(runtime,1.2);
CCFadeOut *fadeOut = CCFadeOut::create(runtime);
CCScaleTo *scaleBack = CCScaleTo::create(runtime,1.05);
CCFadeIn *fadeIn = CCFadeIn::create(runtime);
CCFiniteTimeAction *spawn1 = CCSpawn::create(scaleTo,fadeOut,0);
CCFiniteTimeAction *spawn2 = CCSpawn::create(scaleBack,fadeIn,0);
CCAction *action = CCRepeatForever::create((CCActionInterval*)CCSequence::create(spawn1,spawn2,0));
sprite->runAction(action);
}
}else{
for(unsigned int i = 0;i < m_createSprites.size();i++){
m_createSprites[i]->stopAllActions();
}
}
}
示例13: createExtra
Extra* Extra::createExtra(CCTexture2D* aTexture)
{
Extra* pExtra = new Extra();
pExtra->initWithTexture(aTexture);
pExtra->setTextureRect(CCRectMake(EXTRA_RECT.x, 0, EXTRA_RECT.x, EXTRA_RECT.y));
pExtra->setScale(BRICK_SCALE_FACTOR);
pExtra->autorelease();
CCTexture2D* texture = CCTextureCache::sharedTextureCache()->addImage("gfx/bricks.png");
CCSprite* pShadow = new CCSprite();
pShadow->initWithTexture(texture, CCRectMake(6*EXTRA_RECT.x, 0, EXTRA_RECT.x, EXTRA_RECT.y));
//CCSprite* pShadow= CCSprite::create("gfx/bricks.png", CCRectMake(6*EXTRA_RECT.x, 0, EXTRA_RECT.x, EXTRA_RECT.y));
if (pShadow)
{
pShadow->setScale(0.8f);
pExtra->addChild(pShadow, TagShadow);
pShadow->autorelease();
pShadow->setPosition(ccp(20, -10));
}
return pExtra;
}
示例14: ccTouchesEnded
//.........这里部分代码省略.........
if (!(HH==NULL)){
TASP(haF, hiF, huF, heF, hoF, 151, 152, 153, 154, 155);
TASP2(haF, hiF, huF, heF, hoF, "は", "ひ", "ふ", "へ", "ほ")
this->removeChildByTag(152,true);
this->removeChildByTag(153,true);
this->removeChildByTag(154,true);
this->removeChildByTag(155,true);
}
if (!(MM==NULL)){
TASP(maF, miF, muF, meF, moF, 161, 162, 163, 164, 165);
TASP2(maF, miF, muF, meF, moF, "ま", "み", "む", "め", "も")
this->removeChildByTag(162,true);
this->removeChildByTag(163,true);
this->removeChildByTag(164,true);
this->removeChildByTag(165,true);
}
if (!(YY==NULL)){
//TASP(yaF, yiF, yuF, yeF, yoF, 171, 172, 173, 174, 175);
CCSprite* yaF = (CCSprite*)this->getChildByTag(171);\
CCSprite* yuF = (CCSprite*)this->getChildByTag(173);\
CCSprite* yoF = (CCSprite*)this->getChildByTag(175);\
CCRect rectyaF=CCR(yaF);\
CCRect rectyuF=CCR(yuF);\
CCRect rectyoF=CCR(yoF);\
yaF->retain();\
yuF->retain();\
yoF->retain();\
yaF->autorelease();\
yuF->autorelease();\
yoF->autorelease();\
//TASP2(yaF, yiF, yuF, yeF, yoF, "や", "い", "ゆ", "え", "よ")
if(rectyaF.containsPoint(location)){
flickLabel->setString("や");
CCLog("や");\
}else if(rectyuF.containsPoint(location)){\
flickLabel->setString("ゆ");\
CCLog("ゆ");\
}else if(rectyoF.containsPoint(location)){\
flickLabel->setString("よ");\
CCLog("よ");\
}
this->removeChildByTag(172,true);
this->removeChildByTag(173,true);
this->removeChildByTag(174,true);
this->removeChildByTag(175,true);
}
if (!(RR==NULL)){
TASP(raF, riF, ruF, reF, roF, 181, 182, 183, 184, 185);
TASP2(raF, riF, ruF, reF, roF, "ら", "り", "る", "れ", "ろ")
this->removeChildByTag(182,true);
this->removeChildByTag(183,true);
this->removeChildByTag(184,true);
this->removeChildByTag(185,true);
}
if (!(WW==NULL)){
CCSprite* waF = (CCSprite*)this->getChildByTag(201);
示例15: ccTouchesBegan
////////////フリック入力画面の実装/////////////////////////////////////////////////
void MonsterLayer::ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent)
{
CCLog("タッチ開始");
CCSprite* aF = (CCSprite*)this->getChildByTag(101);
CCSprite* kaF = (CCSprite*)this->getChildByTag(111);
CCSprite* saF = (CCSprite*)this->getChildByTag(121);
CCSprite* taF = (CCSprite*)this->getChildByTag(131);
CCSprite* naF = (CCSprite*)this->getChildByTag(141);
CCSprite* haF = (CCSprite*)this->getChildByTag(151);
CCSprite* maF = (CCSprite*)this->getChildByTag(161);
CCSprite* yaF = (CCSprite*)this->getChildByTag(171);
CCSprite* raF = (CCSprite*)this->getChildByTag(181);
CCSprite* waF = (CCSprite*)this->getChildByTag(201);
CCRect rectA =aF->boundingBox();
CCRect rectKa =kaF->boundingBox();
CCRect rectSa =saF->boundingBox();
CCRect rectTa =taF->boundingBox();
CCRect rectNa =naF->boundingBox();
CCRect rectHa =haF->boundingBox();
CCRect rectMa =maF->boundingBox();
CCRect rectYa =yaF->boundingBox();
CCRect rectRa =raF->boundingBox();
CCRect rectWa =waF->boundingBox();
//CCRect rectK =kaF->boundingBox();
CCTouch* touch = (CCTouch*)pTouches->anyObject();
CCPoint location = touch->getLocationInView();
location = CCDirector::sharedDirector()->convertToGL(location);
if (rectA.containsPoint(location)) {
STADC(aF, iF, uF, eF, oF, "iF.png", "uF.png", "eF.png", "oF.png", 102, 103, 104, 105);
}else if(rectKa.containsPoint(location)){
STADC(kaF, kiF, kuF, keF, koF, "kiF.png", "kuF.png", "keF.png", "koF.png", 112, 113, 114, 115);
}else if(rectSa.containsPoint(location)){
STADC(saF, siF, suF, seF, soF, "siF.png", "suF.png", "seF.png", "soF.png", 122, 123, 124, 125);
}else if(rectTa.containsPoint(location)){
STADC(taF, tiF, tuF, teF, toF, "tiF.png", "tuF.png", "teF.png", "toF.png", 132, 133, 134, 135);
}else if(rectNa.containsPoint(location)){
STADC(naF, niF, nuF, neF, noF, "niF.png", "nuF.png", "neF.png", "noF.png", 142, 143, 144, 145);
}else if(rectHa.containsPoint(location)){
STADC(haF, hiF, huF, heF, hoF, "hiF.png", "huF.png", "heF.png", "hoF.png", 152, 153, 154, 155);
}else if(rectMa.containsPoint(location)){
STADC(maF, miF, muF, meF, moF, "miF.png", "muF.png", "meF.png", "moF.png", 162, 163, 164, 165);
}else if(rectYa.containsPoint(location)){
CCSprite* yuF = CCSprite::create("yuF.png");
yuF->setPosition(ccp(yaF->getPosition().x,yaF->getPositionY()+yaF->getContentSize().height));
this->addChild(yuF,0,173);
CCSprite* yoF = CCSprite::create("yoF.png");
yoF->setPosition(ccp(yaF->getPosition().x,yaF->getPositionY()-yaF->getContentSize().height));
this->addChild(yoF,0,175);
yuF->retain();
yoF->retain();
yuF->autorelease();
yoF->autorelease();
}else if(rectRa.containsPoint(location)){
STADC(raF, riF, ruF, reF, roF, "riF.png", "ruF.png", "reF.png", "roF.png", 182, 183, 184, 185);
}else if(rectWa.containsPoint(location)){
CCSprite* woF = CCSprite::create("woF.png");
woF->setPosition(ccp(waF->getPositionX()-waF->getContentSize().width,waF->getPositionY()));
this->addChild(woF,0,202);
CCSprite* nnF = CCSprite::create("nnF.png");
nnF->setPosition(ccp(waF->getPosition().x,waF->getPositionY()+waF->getContentSize().height));
this->addChild(nnF,0,203);
CCSprite* barF = CCSprite::create("barF.png");
barF->setPosition(ccp(waF->getPositionX()+waF->getContentSize().width,waF->getPositionY()));
this->addChild(barF,0,204);
woF->retain();\
nnF->retain();\
barF->retain();\
woF->autorelease();\
nnF->autorelease();\
barF->autorelease();\
}
}