当前位置: 首页>>代码示例>>C++>>正文


C++ CCMutableArray::autorelease方法代码示例

本文整理汇总了C++中CCMutableArray::autorelease方法的典型用法代码示例。如果您正苦于以下问题:C++ CCMutableArray::autorelease方法的具体用法?C++ CCMutableArray::autorelease怎么用?C++ CCMutableArray::autorelease使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCMutableArray的用法示例。


在下文中一共展示了CCMutableArray::autorelease方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: arrayWithContentsOfFileThreadSafe

CCMutableArray<CCObject*>* CCFileUtils::arrayWithContentsOfFile(const char* pFileName)
{
	//convert to full path
	std::string fileFullPath;
	fileFullPath = CCFileUtils::fullPathFromRelativePath(pFileName);
	CCMutableArray<CCObject*>* ret = arrayWithContentsOfFileThreadSafe(fileFullPath.c_str());
    ret->autorelease();
    return ret;
}
开发者ID:YarinYang,项目名称:cocos2dx-win8,代码行数:9,代码来源:CCFileUtils.cpp

示例2:

/*
 * 文字列リストを取得。
 */
CCMutableArray<ColorString*> *TagString::getStringList( int line )
{
    CCMutableArray<ColorString*> *list = new CCMutableArray<ColorString*>;
    list->autorelease();
    
    for( int i = 0; i < parseList->count(); i++ )
    {
        ColorString* cstr = parseList->getObjectAtIndex( i );
        if( cstr->getLine() != line ) continue;
        
        list->addObject( cstr );
    }
    
    return list;
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例3:

CCMutableArray<CCObject*>* CCSet::allObjects()
{
	CCMutableArray<CCObject*>* objectArray = new CCMutableArray<CCObject*>(10);
	objectArray->autorelease();

	CCObject* object;
	CCSetIterator it;
	for( it = this->begin(); it != this->end(); it++)
	{
		object = (*it);
		objectArray->addObject(object);
	}

	return objectArray;
}
开发者ID:jordo,项目名称:cocos2d-x,代码行数:15,代码来源:CCSet.cpp

示例4: cacheAnimations

void AnimatableDecorator::cacheAnimations() const {
  for (Value animationValue : animations()) {      
    {
      Array<Value> frames = animationValue.mapValue()["frames"].arrayValue();
      
      CCMutableArray<CCSpriteFrame*>* spriteFrames = new CCMutableArray<CCSpriteFrame*>();
      spriteFrames->autorelease();
      
      for (Value frame : frames) {
        CCSpriteFrame* spriteFrame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(frame.string().c_str());
        spriteFrames->addObject(spriteFrame);
      }
      
      float delay = animationValue.mapValue()["delay"].floatValue();
      CCAnimation* animation = CCAnimation::animationWithFrames(spriteFrames, delay);
      CCAnimationCache::sharedAnimationCache()->addAnimation(animation, animationValue.mapValue()["name"].string().c_str());
    }
  }
}
开发者ID:nkostelnik,项目名称:WonderPants,代码行数:19,代码来源:AnimatableDecorator.cpp

示例5: ColorString


//.........这里部分代码省略.........
    // アライン設定
    if( baseAlign == TEXT_ALIGN_CENTER_TOP )
    {
        basex = ( ( width - getStringWidth() )/2 );
    }
    
    if( baseAlign == TEXT_ALIGN_RIGHT_TOP )
    {
        basex = width - getStringWidth();
    }
    
    if( baseAlign == TEXT_ALIGN_LEFT_MIDDLE )
    {
        basey = ( ( height - getStringHeight() )/2 );
    }
    
    if( baseAlign == TEXT_ALIGN_CENTER_MIDDLE )
    {
        basex = ( ( width  - getStringWidth()  )/2 );
        basey = ( ( height - getStringHeight() )/2 );
    }
    
    if( baseAlign == TEXT_ALIGN_RIGHT_MIDDLE )
    {
        basex = width - getStringWidth();
        basey = ( ( height - getStringHeight() )/2 );
    }
    
    if( baseAlign == TEXT_ALIGN_CENTER_BOTTOM )
    {
        basex = ( ( width  - getStringWidth()  )/2 );
        basey = height - getStringHeight();
    }
    
    if( baseAlign == TEXT_ALIGN_RIGHT_BOTTOM )
    {
        basex = width - getStringWidth();
        basey = height - getStringHeight();
    }
    
    if( baseAlign == TEXT_ALIGN_LEFT_BOTTOM )
    {
        basey = height - getStringHeight();
    }
    
    float dispx = basex;
    float dispy = basey;
    
    // 返却用のリスト
    CCMutableArray<StringLabel*>* ret = new CCMutableArray<StringLabel*>;
    ret->autorelease();
    
    // ラベルを生成
    for( int i = 0; i < linecnt; i++ )
    {
        CCMutableArray<ColorString*> *list = getStringList( i );
        
        float lh = getStringLineHeight( i );
        float lw = getStringLineWidth( i );
        
        // 下合わせ
        dispy += lh;
        
        for( int j = 0; j < list->count(); j++ )
        {
            ColorString* cstr = list->getObjectAtIndex( j );
            
            // アライン
            if( j == 0 )
            {
                if( cstr->getAlign() == ALIGN_LEFT   ) dispx = 0;
                if( cstr->getAlign() == ALIGN_CENTER ) dispx = ((width-lw)/2);
                if( cstr->getAlign() == ALIGN_RIGHT  ) dispx = width - lw;
            }    
            
            // テキストを設定
            StringLabel* label = cstr->getStrLabel();
            
            label->setAlign( TEXT_ALIGN_LEFT_BOTTOM );
            //label->setPosition( dispx, dispy );
            label->setOffsetX( dispx );
            label->setOffsetY( dispy );
            
            ret->addObject( label );
            
            // ラベルサイズ取得
            CCSize size = label->getContentSize();
            dispx += size.width;
        }
        
        dispx  = basex;
    }
    
    
    return ret;
    
    
    
    
}
开发者ID:,项目名称:,代码行数:101,代码来源:


注:本文中的CCMutableArray::autorelease方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。