本文整理汇总了C++中AnimatedSprite::getSprite方法的典型用法代码示例。如果您正苦于以下问题:C++ AnimatedSprite::getSprite方法的具体用法?C++ AnimatedSprite::getSprite怎么用?C++ AnimatedSprite::getSprite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnimatedSprite
的用法示例。
在下文中一共展示了AnimatedSprite::getSprite方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clearElements
void Senario::clearElements()
{
for(int i = 0; i < spriteList.size(); i++)
{
this->removeChild(spriteList.at(i), true);
}
for(int i = 0; i < menuList.size(); i++)
{
this->removeChild(menuList.at(i), true);
}
for(int i = 0; i < labelList.size(); i++)
{
this->removeChild(labelList.at(i), true);
}
spriteList.clear();
menuList.clear();
labelList.clear();
for(int i = 0; i < animatedStringList->count(); i++)
{
AnimatedString* as = (AnimatedString*) animatedStringList->objectAtIndex(i);
this->removeChild(as->getLabel(), true);
}
animatedStringList->removeAllObjects();
CC_SAFE_RELEASE(animatedStringList);
animatedStringList = CCArray::create();
animatedStringList->retain();
for(int i = 0; i < animatedSpriteList->count(); i++)
{
AnimatedSprite* as = (AnimatedSprite*) animatedSpriteList->objectAtIndex(i);
this->removeChild(as->getSprite(), true);
}
animatedSpriteList->removeAllObjects();
CC_SAFE_RELEASE(animatedSpriteList);
animatedSpriteList = CCArray::create();
animatedSpriteList->retain();
for(int i = 0; i < animatedDialogueList->count(); i++)
{
AnimatedDialogue* ad = (AnimatedDialogue*) animatedDialogueList->objectAtIndex(i);
this->removeChild(ad->getSprite(), true);
}
animatedDialogueList->removeAllObjects();
CC_SAFE_RELEASE(animatedDialogueList);
animatedDialogueList = CCArray::create();
animatedDialogueList->retain();
if(skipButton != NULL)
{
CC_SAFE_RELEASE(skipButton);
skipButton = NULL;
}
}
示例2: constructSenarioStage
bool Senario::constructSenarioStage(bool skip)
{
CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
ccColor3B colorBlack = ccc3(0, 0, 0);
// ccColor3B colorYellow = ccc3(225, 219, 108);
ccColor3B colorBlue = ccc3(0, 0, 255);
clearElements();
if(slidesList->count() <= curSlide)
{
return false;
}
Slide* slide = (Slide*)slidesList->objectAtIndex(curSlide);
CCArray* elementArray = slide->elementList;
if(slide->isScene)
{
CCTextureCache::sharedTextureCache()->removeAllTextures();
CCTextureCache::sharedTextureCache()->purgeSharedTextureCache();
CCAnimationCache::sharedAnimationCache()->purgeSharedAnimationCache();
CCDirector::sharedDirector()->purgeCachedData();
backgroundImage = slide->scene_src;
}
CCSprite* blackScreen = CCSprite::create(backgroundImage.c_str());
blackScreen->setScale(screenSize.width / blackScreen->boundingBox().size.width);
blackScreen->setAnchorPoint(ccp(0.5, 0.5));
blackScreen->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f));
this->addChild(blackScreen, 1);
spriteList.push_back(blackScreen);
skipButton = CCSprite::create("skip_button.png");
skipButton->retain();
skipButton->setScale(1.0f);
skipButton->setAnchorPoint(ccp(1, 1));
skipButton->setPosition(ccp(screenSize.width, screenSize.height));
this->addChild(skipButton, 2);
spriteList.push_back(skipButton);
if(slide->hasVideo)
{
//Config *c = Config::getConfig();
if(slide->video_clip.compare("") != 0)
{
WrapperClass::getShared()->playVideo(slide->video_clip.c_str());
}
}
if(slide->playBGM)
{
if(slide->bgm_clip.compare("") != 0)
{
SoundtrackManager::PlayBGM(slide->bgm_clip);
}
}
if(slide->playSFX)
{
if(slide->sfx_clip.compare("") != 0)
{
SoundtrackManager::PlaySFX(slide->sfx_clip);
}
}
if(GameScene::getThis()->systemConfig->hideSkipButton)
{
skipButton->setAnchorPoint(ccp(0, 1));
skipButton->setPosition(ccp(screenSize.width, screenSize.height));
}
bool isChoosingOption = false;
for(int i = 0; i < elementArray->count(); i++)
{
Element* ele = (Element*)elementArray->objectAtIndex(i);
/*
* In the senario stage, there are two types of elements -> sprite and dialogue, treat these two types of elements differently in order to make this display them correctly!
*/
if(ele->type == Element::sprite)
{
/*
* Sprite: only has a picture of the sprite shown on the screen
* Future: may include animation of the sprite shown on the screen (probably a gif?)
*/
AnimatedSprite* as = AnimatedSprite::create(ele->src.c_str(), ele->fadeIn, ele->fadeOut, true);
stringstream ss;
CCSprite* cha = as->getSprite();
CCSize spriteSize = cha->getContentSize();
cha->setScale(screenSize.width / spriteSize.width * ele->width / 100.0f);
cha->setFlipX(true);
cha->setAnchorPoint(ccp(0, 1));
cha->setPosition(ccp(screenSize.width * (ele->left / 100.0f), screenSize.height * (ele->top / 100.0f)));
this->addChild(cha, 2);
//.........这里部分代码省略.........