void CCAnimate::startWithTarget(CCNode *pTarget) { CCActionInterval::startWithTarget(pTarget); CCSprite *pSprite = (CCSprite*)(pTarget); CCX_SAFE_RELEASE(m_pOrigFrame); if (m_bRestoreOriginalFrame) { m_pOrigFrame = pSprite->displayedFrame(); m_pOrigFrame->retain(); } }
// ParticleSystem - CCTexture protocol void CCParticleSystem::setTexture(CCTexture2D* var) { CCX_SAFE_RETAIN(var); CCX_SAFE_RELEASE(m_pTexture) m_pTexture = var; // If the new texture has No premultiplied alpha, AND the blendFunc hasn't been changed, then update it if( m_pTexture && ! m_pTexture->getHasPremultipliedAlpha() && ( m_tBlendFunc.src == CC_BLEND_SRC && m_tBlendFunc.dst == CC_BLEND_DST ) ) { m_tBlendFunc.src = GL_SRC_ALPHA; m_tBlendFunc.dst = GL_ONE_MINUS_SRC_ALPHA; } }
bool CCTMXTiledMap::initWithTMXFile(const char *tmxFile) { NSAssert(tmxFile != NULL && strlen(tmxFile)>0, "TMXTiledMap: tmx file should not bi nil"); setContentSize(CGSizeZero); CCTMXMapInfo *mapInfo = CCTMXMapInfo::formatWithTMXFile(tmxFile); NSAssert( mapInfo->getTilesets()->count() != 0, "TMXTiledMap: Map not found. Please check the filename."); m_tMapSize = mapInfo->getMapSize(); m_tTileSize = mapInfo->getTileSize(); m_nMapOrientation = mapInfo->getOrientation(); setObjectGroups(mapInfo->getObjectGroups()); setProperties(mapInfo->getProperties()); CCX_SAFE_RELEASE(m_pTileProperties); m_pTileProperties = mapInfo->getTileProperties(); CCX_SAFE_RETAIN(m_pTileProperties); int idx = 0; NSMutableArray<CCTMXLayerInfo*>* layers = mapInfo->getLayers(); if (layers && layers->count()>0) { CCTMXLayerInfo *layerInfo = NULL; NSMutableArray<CCTMXLayerInfo*>::NSMutableArrayIterator it; for (it = layers->begin(); it != layers->end(); ++it) { layerInfo = *it; if (layerInfo && layerInfo->m_bVisible) { CCTMXLayer *child = parseLayer(layerInfo, mapInfo); addChild((CCNode*)child, idx, idx); // update content size with the max size CGSize childSize = child->getContentSize(); CGSize currentSize = this->getContentSize(); currentSize.width = MAX( currentSize.width, childSize.width ); currentSize.height = MAX( currentSize.height, childSize.height ); this->setContentSize(currentSize); idx++; } } } return true; }
void CCSprite::setTexture(CCTexture2D *texture) { // CCSprite: setTexture doesn't work when the sprite is rendered using a CCSpriteSheet assert(! m_bUsesBatchNode); // we can not use RTTI, so we do not known the type of object // accept texture==nil as argument /*assert((! texture) || dynamic_cast<CCTexture2D*>(texture));*/ CCX_SAFE_RELEASE(m_pobTexture); m_pobTexture = texture; if (texture) { texture->retain(); } updateBlendFunc(); }
bool CCLabelBMFont::initWithString(const char *theString, const char *fntFile) { assert(theString != NULL); CCX_SAFE_RELEASE(m_pConfiguration);// allow re-init m_pConfiguration = FNTConfigLoadFile(fntFile); m_pConfiguration->retain(); NSAssert( m_pConfiguration, "Error creating config for BitmapFontAtlas"); if (CCSpriteBatchNode::initWithFile(m_pConfiguration->m_sAtlasName.c_str(), strlen(theString))) { m_cOpacity = 255; m_tColor = ccWHITE; m_tContentSize = CGSizeZero; m_bIsOpacityModifyRGB = m_pobTextureAtlas->getTexture()->getHasPremultipliedAlpha(); m_tAnchorPoint = ccp(0.5f, 0.5f); this->setString(theString); return true; } return false; }
CCEaseAction::~CCEaseAction(void) { CCX_SAFE_RELEASE(m_pOther); }
// // MenuItemToggle // void CCMenuItemToggle::setSubItems(NSMutableArray<CCMenuItem*>* var) { CCX_SAFE_RETAIN(var); CCX_SAFE_RELEASE(m_pSubItems); m_pSubItems = var; }
// // Speed // CCSpeed::~CCSpeed() { CCX_SAFE_RELEASE(m_pOther); }
void CCActionManager::purgeSharedManager(void) { CCScheduler::sharedScheduler()->unscheduleUpdateForTarget(this); CCX_SAFE_RELEASE(gSharedManager); }
CCSprite::~CCSprite(void) { CCX_SAFE_RELEASE(m_pobTexture); CCX_SAFE_RELEASE(m_pAnimations); }
CCAnimate::~CCAnimate(void) { CCX_SAFE_RELEASE(m_pAnimation); CCX_SAFE_RELEASE(m_pOrigFrame); }
CCTMXTiledMap::~CCTMXTiledMap() { CCX_SAFE_RELEASE(m_pProperties); CCX_SAFE_RELEASE(m_pObjectGroups); CCX_SAFE_RELEASE(m_pTileProperties); }
void CCTMXTiledMap::setProperties(CCXStringToStringDictionary* var) { CCX_SAFE_RETAIN(var); CCX_SAFE_RELEASE(m_pProperties); m_pProperties = var; }
void CCTMXTiledMap::setObjectGroups(NSMutableArray<CCTMXObjectGroup*>* var) { CCX_SAFE_RETAIN(var); CCX_SAFE_RELEASE(m_pObjectGroups); m_pObjectGroups = var; }