本文整理汇总了C++中AnimatedSprite::init方法的典型用法代码示例。如果您正苦于以下问题:C++ AnimatedSprite::init方法的具体用法?C++ AnimatedSprite::init怎么用?C++ AnimatedSprite::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnimatedSprite
的用法示例。
在下文中一共展示了AnimatedSprite::init方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create
AnimatedSprite* AnimatedSprite::create(std::string filepath, int columns, int rows)
{
AnimatedSprite* animatedsprite = new AnimatedSprite();
animatedsprite->init(filepath, columns, rows);
animatedsprite->autorelease();
return animatedsprite;
}
示例2: create
//static
AnimatedSprite* AnimatedSprite::create( AnimationLogic* animLogic, JsonValueRef spriteFrames )
{
AnimatedSprite* sprite = new AnimatedSprite();
sprite->init(animLogic, spriteFrames);
sprite->autorelease();
return sprite;
}
示例3: create
AnimatedSprite* AnimatedSprite::create(std::string filename)
{
AnimatedSprite *pSprite = new (std::nothrow) AnimatedSprite();
if (pSprite && pSprite->init())
{
cocos2d::SpriteFrameCache * cache = cocos2d::SpriteFrameCache::getInstance();
cache->addSpriteFramesWithFile(cocos2d::String::createWithFormat("anims/%s.plist", filename.c_str())->getCString());
if (pSprite->initWithSpriteFrameName(cocos2d::String::createWithFormat("anims/%s_01.png", filename.c_str())->getCString()))
{
auto cache = cocos2d::AnimationCache::getInstance();
cache->addAnimationsWithFile(cocos2d::String::createWithFormat("anims/%s.plist", filename.c_str())->getCString());
pSprite->runAction(AnimationUtils::getAnimationRunningForever((filename + "_idle").c_str()));
pSprite->autorelease();
return pSprite;
}
}
CC_SAFE_DELETE(pSprite);
return NULL;
}