本文整理汇总了C++中CCNodeLoaderLibrary类的典型用法代码示例。如果您正苦于以下问题:C++ CCNodeLoaderLibrary类的具体用法?C++ CCNodeLoaderLibrary怎么用?C++ CCNodeLoaderLibrary使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCNodeLoaderLibrary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
CCDirector* pDirector = CCDirector::sharedDirector();
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
pDirector->setOpenGLView(pEGLView);
// デザインサイズの設定
pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder);
CCSize frameSize = pEGLView->getFrameSize();
std::vector<std::string> searchPath;
if (frameSize.height > largeResource.size.height)
{
// iPad Retina用リソースを使用
searchPath.push_back(xlargeResource.directory);
pDirector->setContentScaleFactor(MIN(xlargeResource.size.height / designResolutionSize.height, xlargeResource.size.width / designResolutionSize.width));
}
else if (frameSize.height > smallResource.size.height)
{
// iPad用リソースを使用
searchPath.push_back(largeResource.directory);
pDirector->setContentScaleFactor(MIN(largeResource.size.height / designResolutionSize.height, largeResource.size.width / designResolutionSize.width));
}
else
{
// iPhone用リソースを使用
searchPath.push_back(smallResource.directory);
pDirector->setContentScaleFactor(MIN(smallResource.size.height / designResolutionSize.height, smallResource.size.width / designResolutionSize.width));
}
// リソースディレクトリを指定
CCFileUtils::sharedFileUtils()->setSearchPaths(searchPath);
// turn on display FPS
pDirector->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
pDirector->setAnimationInterval(1.0 / 60);
// CocosBuilderのファイルを読み込みゲーム画面を生成する
CCNodeLoaderLibrary* ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
ccNodeLoaderLibrary->registerCCNodeLoader("GameLayer", GameLayerLoader::loader());
CCBReader* ccbReader = new CCBReader(ccNodeLoaderLibrary);
CCNode* node = ccbReader->readNodeGraphFromFile("GameLayer.ccbi");
((GameLayer*)node)->setAnimationManager(ccbReader->getAnimationManager());
// シーンを用意し、ゲーム画面を設置する
CCScene* pScene = CCScene::create();
if (node != NULL)
pScene->addChild(node);
ccbReader->release();
// run
pDirector->runWithScene(pScene);
return true;
}
示例2: GetMenuLoadingLayer
CMenuLoading* CMenuLoading::GetMenuLoadingLayer(cocos2d::CCScene* _pScene, int _iLevel, int _difficult, bool _bShop)
{
AppDelegate::AudioStopBgm();
CMenuLoading* pLayer = new CMenuLoading;
pLayer->autorelease();
pLayer->m_pScene = _pScene;
pLayer->m_iLevel = _iLevel;
pLayer->m_iDifficult = _difficult;
pLayer->m_bShop = _bShop;
CMainMenu::SetStatus(-1);
CCNodeLoaderLibrary* ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
ccNodeLoaderLibrary->registerCCNodeLoader("ccbLoadingMenu", ccbGameLoadingMenuLoader::loader());
cocos2d::extension::CCBReader* ccbReader = new cocos2d::extension::CCBReader(ccNodeLoaderLibrary);
pLayer->m_pNode = ccbReader->readNodeGraphFromFile("10.ccbi"/*, this*/);
pLayer->m_pNode->setPosition(ccp(0,0));
((ccbGameLoadingMenu*)pLayer->m_pNode)->setAnimationManager(ccbReader->getAnimationManager());
((ccbGameLoadingMenu*)pLayer->m_pNode)->Appear();
ccbReader->release();
SetScale(pLayer->m_pNode);
_pScene->addChild(pLayer->m_pNode, 21, 4);
//SetScale(pLayer);
_pScene->addChild(pLayer, 20, 3);
CCLayerColor* pLayerColor = CCLayerColor::create(ccc4(20,20,20,255), 800, 480);
SetScale(pLayerColor);
_pScene->addChild(pLayerColor, 19, 2);
//AppDelegate::AudioPlayEffect("MS/Sound/EfLoadingOpen.mp3");
return pLayer;
}
示例3: openTest
void HelloCocosBuilderLayer::openTest(const char * pCCBFileName, const char * pCCNodeName, CCNodeLoader * pCCNodeLoader) {
/* Create an autorelease CCNodeLoaderLibrary. */
CCNodeLoaderLibrary * ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
ccNodeLoaderLibrary->registerCCNodeLoader("TestHeaderLayer", TestHeaderLayerLoader::loader());
if(pCCNodeName != NULL && pCCNodeLoader != NULL) {
ccNodeLoaderLibrary->registerCCNodeLoader(pCCNodeName, pCCNodeLoader);
}
/* Create an autorelease CCBReader. */
cocos2d::extension::CCBReader * ccbReader = new cocos2d::extension::CCBReader(ccNodeLoaderLibrary);
ccbReader->autorelease();
/* Read a ccbi file. */
// Load the scene from the ccbi-file, setting this class as
// the owner will cause lblTestTitle to be set by the CCBReader.
// lblTestTitle is in the TestHeader.ccbi, which is referenced
// from each of the test scenes.
CCNode * node = ccbReader->readNodeGraphFromFile(pCCBFileName, this);
this->mTestTitleLabelTTF->setString(pCCBFileName);
CCScene * scene = CCScene::create();
if(node != NULL) {
scene->addChild(node);
}
/* Push the new scene with a fancy transition. */
ccColor3B transitionColor;
transitionColor.r = 0;
transitionColor.g = 0;
transitionColor.b = 0;
CCDirector::sharedDirector()->pushScene(CCTransitionFade::create(0.5f, scene, transitionColor));
}
示例4: js_CocosBuilder_create
JSBool js_CocosBuilder_create(JSContext *cx, uint32_t argc, jsval *vp)
{
CCNodeLoaderLibrary * ccNodeLoaderLibrary = CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary();
ccNodeLoaderLibrary->registerCCNodeLoader("", JSLayerLoader::loader());
cocos2d::extension::CCBReader * ret = new cocos2d::extension::CCBReader(ccNodeLoaderLibrary);
ret->autorelease();
jsval jsret;
if (ret) {
js_proxy_t *proxy;
JS_GET_PROXY(proxy, ret);
if (proxy) {
jsret = OBJECT_TO_JSVAL(proxy->obj);
} else {
// create a new js obj of that class
proxy = js_get_or_create_proxy<cocos2d::extension::CCBReader>(cx, ret);
jsret = OBJECT_TO_JSVAL(proxy->obj);
}
} else {
jsret = JSVAL_NULL;
}
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
示例5:
CCNodeLoaderLibrary * CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary() {
CCNodeLoaderLibrary * ccNodeLoaderLibrary = CCNodeLoaderLibrary::library();
ccNodeLoaderLibrary->registerDefaultCCNodeLoaders();
return ccNodeLoaderLibrary;
}
示例6: getMainScene
CCScene* MainScene::getMainScene() {
CCNodeLoaderLibrary * ccNodeLoaderLibrary = CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary();
ccNodeLoaderLibrary->registerCCNodeLoader("MainScene", MainSceneLoader::loader());
CCBReader *ccbReader = new cocos2d::extension::CCBReader(ccNodeLoaderLibrary);
return ccbReader->createSceneWithNodeGraphFromFile("ccb/MainScreen.ccbi");
}
示例7: showFlower
void BaseBug::showFlower(){
CCString filename = "flower-0.ccbi";
CCNodeLoaderLibrary* loaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
loaderLibrary->registerCCNodeLoader("CCParticleSystemQuad", CCParticleSystemQuadLoader::loader());
cocos2d::extension::CCBReader* ccbReader = new cocos2d::extension::CCBReader(loaderLibrary);
CCNode* node = ccbReader->readNodeGraphFromFile(filename.m_sString.c_str());
CCParticleSystemQuad* emitter = (CCParticleSystemQuad*) node;
this->addChild(emitter);
}
示例8: loadCustomParts
//---------------------------------------
// カスタムクラスのパーツの取得(クラス名指定あり)
//---------------------------------------
CCNode* SceneChanger::loadCustomParts(const char* className, const char* fileName, CCNodeLoader* loader) {
CCNodeLoaderLibrary* ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
ccNodeLoaderLibrary->registerCCNodeLoader(className, loader);
CCBReader* ccbReader = new CCBReader(ccNodeLoaderLibrary);
CCString* file = CCString::createWithFormat("%s.ccbi", fileName);
CCNode* node = ccbReader->readNodeGraphFromFile(file->getCString());
ccbReader->release();
return node;
}
示例9: getStoreBScene
CCScene* StoreBScene::getStoreBScene() {
CCNodeLoaderLibrary * ccNodeLoaderLibrary = CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary();
ccNodeLoaderLibrary->registerCCNodeLoader("StoreBScene", StoreBSceneLoader::loader());
CCBReader *ccbReader = new CCBReader(ccNodeLoaderLibrary);
ccbReader->retain();
CCScene *pScene = ccbReader->createSceneWithNodeGraphFromFile("ccb/StoreBScene.ccbi");
ccbReader->release();
return pScene;
}
示例10: LoadFromCCBI
// load ccnode from ccbi
CCNode* CCBLoaderManager::LoadFromCCBI(CCNodeLoader* loader, const char* className, const char* ccbFileName)
{
CCNodeLoaderLibrary * ccNodeLoaderLibrary = CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary();
ccNodeLoaderLibrary->registerCCNodeLoader(className, loader);
CCBReader* ccbReader = new CCBReader(ccNodeLoaderLibrary);
std::string path = "ccbi/";
path.append(ccbFileName);
CCNode* node = ccbReader->readNodeGraphFromFile(path.c_str());
delete ccbReader;
return node;
}
示例11: createCCBreader
CCBReader* CCBProxy::createCCBreader()
{
CCNodeLoaderLibrary *ccNodeLoaderLibrary = CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary();
ccNodeLoaderLibrary->registerCCNodeLoader("", CCBLayerLoader::loader());
CCBReader * pCCBReader = new CCBReader(ccNodeLoaderLibrary);
pCCBReader->autorelease();
return pCCBReader;
}
示例12: node
FruitObject* FruitObject::node(const char *ccbName,int color)
{
CCNodeLoaderLibrary *nodeLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
nodeLibrary->registerCCNodeLoader("FruitObject", FruitObjectLoader::loader());
CCBReader *ccbReader = new CCBReader(nodeLibrary);
FruitObject *node1 = (FruitObject *)ccbReader->readNodeGraphFromFile(ccbName);
node1->color = color;
node1->choose = false;
// ccbReader->release();
return node1;
}
示例13: GameLoadingSecond
void CGameControler::GameLoadingSecond()
{
CCNodeLoaderLibrary* ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
ccNodeLoaderLibrary->registerCCNodeLoader("ccbControlMenu", ccbControlMenuLoader::loader());
cocos2d::extension::CCBReader* ccbReader = new cocos2d::extension::CCBReader(ccNodeLoaderLibrary);
m_pMenuNode = ccbReader->readNodeGraphFromFile("6.ccbi"/*, this*/);
m_pMenuNode->setPosition(ccp(0,0));
//SetScale(m_pMenuNode);
((ccbControlMenu*)m_pMenuNode)->setAnimationManager(ccbReader->getAnimationManager(), m_unLevel);
ccbReader->release();
addChild(m_pMenuNode, 4, 50);
}
示例14: loaderBug
void BaseBug::loaderBug(CCPoint point){
CCBAnimationManager* pAnimationManager = NULL;
CCNodeLoaderLibrary* ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
ccNodeLoaderLibrary->registerCCNodeLoader("BaseBugCCBI", BaseBugCCBILoader::loader());
cocos2d::extension::CCBReader* ccbReader = new cocos2d::extension::CCBReader(ccNodeLoaderLibrary);
CCNode* node = ccbReader->readNodeGraphFromFile(m_fileName.m_sString.c_str(), this, &pAnimationManager);
ccbReader->autorelease();
m_bug = (BaseBugCCBI*)node;
m_bug->setAnimationManager(pAnimationManager);
this->addChild(m_bug);
}
示例15: bomb
Bomb* Bomb::bomb()
{
CCNodeLoaderLibrary *nodeLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
nodeLibrary->registerCCNodeLoader("Bomb", BombLoader::loader());
CCBReader *ccbReader = new CCBReader(nodeLibrary);
Bomb *node = (Bomb *)ccbReader->readNodeGraphFromFile("ccb/bomb");
ccbReader->getAnimationManager()->setAnimationCompletedCallback(node, callfunc_selector(Bomb::test));
ccbReader->release();
// CCBAnimationManager * ccbManager = (CCBAnimationManager *)node->getUserObject();
// ccbManager->setAnimationCompletedCallback(node, callfunc_selector(Bomb::test));
return node;
}