本文整理汇总了C++中Tools::updateRooted方法的典型用法代码示例。如果您正苦于以下问题:C++ Tools::updateRooted方法的具体用法?C++ Tools::updateRooted怎么用?C++ Tools::updateRooted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tools
的用法示例。
在下文中一共展示了Tools::updateRooted方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
// on "init" you need to initialize your instance
bool LayerLoading::init()
{
bool bRet = false;
do
{
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(1024, 576, kResolutionShowAll);
m_nNumberOfLoadedSprites=0;
//////////////////////////////////////////////////////////////////////////
// super init first
//////////////////////////////////////////////////////////////////////////
CC_BREAK_IF(! CCLayer::init());
CCSize s = CCDirector::sharedDirector()->getWinSize();
// Add a label
pLabel = CCLabelTTF::create("Loading...", "Arial", 24);
CC_BREAK_IF(! pLabel);
pLabel->setPosition(ccp(s.width / 2, s.height * 0.15f));
this->addChild(pLabel, 1);
// 3. Add add a splash screen, show the cocos2d splash image.
CCSprite* pSprite = CCSprite::create("scene_loading_bg.png");
CC_BREAK_IF(! pSprite);
pSprite->setPosition(ccp(s.width/2, s.height/2));
this->addChild(pSprite, 0);
pSprite->setScaleX(s.width / pSprite->getContentSize().width);
pSprite->setScaleY(s.height/ pSprite->getContentSize().height);
char temp[32]; //注意不要越界
for(int i =1;i<14;i++){
sprintf(temp,"card_clubs_%d.png",i);
CCTextureCache::sharedTextureCache()->addImageAsync(temp, this, callfuncO_selector(LayerLoading::loadingCallBack));
}
for(int i =1;i<14;i++){
sprintf(temp,"card_diamonds_%d.png",i);
CCTextureCache::sharedTextureCache()->addImageAsync(temp, this, callfuncO_selector(LayerLoading::loadingCallBack));
}
for(int i =1;i<14;i++){
sprintf(temp,"card_hearts_%d.png",i);
CCTextureCache::sharedTextureCache()->addImageAsync(temp, this, callfuncO_selector(LayerLoading::loadingCallBack));
}
for(int i =1;i<14;i++){
sprintf(temp,"card_spades_%d.png",i);
CCTextureCache::sharedTextureCache()->addImageAsync(temp, this, callfuncO_selector(LayerLoading::loadingCallBack));
}
CCTextureCache::sharedTextureCache()->addImageAsync("scene_game_bg_desk.png", this, callfuncO_selector(LayerLoading::loadingCallBack));
CCTextureCache::sharedTextureCache()->addImageAsync("scene_welcome_logo.png", this, callfuncO_selector(LayerLoading::loadingCallBack));
CCTextureCache::sharedTextureCache()->addImageAsync("scene_welcome_info_bg.png", this, callfuncO_selector(LayerLoading::loadingCallBack));
CCTextureCache::sharedTextureCache()->addImageAsync("scene_welcome_bg.png", this, callfuncO_selector(LayerLoading::loadingCallBack));
CCSprite *m_loading_0 =CCSprite::create("scene_loading_0.png");
addChild(m_loading_0);
m_loading_0->setAnchorPoint(ccp(0.5f,0.5f));
m_loading_0->setPosition(ccp(s.width/2, s.height/2));
m_loading_bar = CCProgressTimer::create(CCSprite::create("scene_loading_100.png"));
m_loading_bar->setType(kCCProgressTimerTypeBar);
m_loading_bar->setMidpoint(ccp(0,0));
m_loading_bar->setBarChangeRate(ccp(0, 1));
addChild(m_loading_bar);
m_loading_bar->setAnchorPoint(ccp(0.5f,0.5f));
m_loading_bar->setPosition(ccp(s.width/2, s.height/2));
// CCProgressTo *to = CCProgressTo::create(2,100);
// CCFiniteTimeAction* fn = CCCallFunc::create(this,callfunc_selector(LayerLoading::enterSceneWelcome));
// CCActionInterval* seq = CCSequence::create(to,fn,NULL);
//
// m_loading_bar->runAction(seq);
//合法性检查,注意调用顺序
Tools* tools =Tools::sharedTools();
tools->updateRooted();
tools->checkEncryptionAll(this);
bRet = true;
} while (0);
return bRet;
}